rails_best_practices 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -58,7 +58,7 @@ Donating
|
|
58
58
|
Install
|
59
59
|
-------
|
60
60
|
|
61
|
-
|
61
|
+
rails_best_practices gem is rewritten based on ripper instead of ruby_parser to support ruby 1.9 new syntax.
|
62
62
|
|
63
63
|
Ruby 1.9
|
64
64
|
|
@@ -22,7 +22,7 @@ class Sexp
|
|
22
22
|
# => 2
|
23
23
|
def line
|
24
24
|
if [:def, :command, :command_call, :call, :fcall, :method_add_arg, :method_add_block,
|
25
|
-
:var_ref, :const_ref, :class, :module, :if, :unless, :elsif, :binary].include? sexp_type
|
25
|
+
:var_ref, :const_ref, :const_path_ref, :class, :module, :if, :unless, :elsif, :binary].include? sexp_type
|
26
26
|
self[1].line
|
27
27
|
else
|
28
28
|
self.last.first if self.last.is_a? Array
|
@@ -6,6 +6,7 @@ describe Sexp do
|
|
6
6
|
content = <<-EOF
|
7
7
|
class Demo
|
8
8
|
def test
|
9
|
+
ActiveRecord::Base.connection
|
9
10
|
end
|
10
11
|
end
|
11
12
|
EOF
|
@@ -19,6 +20,14 @@ describe Sexp do
|
|
19
20
|
it "should return def line" do
|
20
21
|
@node.grep_node(:sexp_type => :def).line.should == 2
|
21
22
|
end
|
23
|
+
|
24
|
+
it "should return const line" do
|
25
|
+
@node.grep_node(:sexp_type => :const_ref).line.should == 1
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return const path line" do
|
29
|
+
@node.grep_node(:sexp_type => :const_path_ref).line.should == 3
|
30
|
+
end
|
22
31
|
end
|
23
32
|
|
24
33
|
describe "grep_nodes" do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rails_best_practices
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Richard Huang
|
@@ -281,7 +281,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
281
281
|
requirements:
|
282
282
|
- - ">="
|
283
283
|
- !ruby/object:Gem::Version
|
284
|
-
hash:
|
284
|
+
hash: -611443156274023641
|
285
285
|
segments:
|
286
286
|
- 0
|
287
287
|
version: "0"
|