code_analyzer 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acb16ff0641c7cecd7c88ba37acccd70096bfd07
4
- data.tar.gz: cc27133da8f3b783580002ef92b2b6f514e58c8a
3
+ metadata.gz: 3723a944cc80445e3d5dc42360bf001e1bf66221
4
+ data.tar.gz: 37a887ceee61cdb1fb1e8227112e102e06b0e047
5
5
  SHA512:
6
- metadata.gz: 0542120dedeb3c25c3038d89f12c2538c899630cf7d0f2e0bd2699d37a161b5ec46f7bae9e45a3e784af269fbaf13c8ef85cff8ee0e12dee40316b41d9f488c3
7
- data.tar.gz: 66375301eae5426ff0585bffe9aa182e501bc89f89505c52575a260feeff8388c03a9c1f0b5804f6e8b116c8d7d3c02331e5b8cc36b8b91e74b7b93bd8507e03
6
+ metadata.gz: f308e1967ea4b8dffb44d338bb691445587fcfaffc46c33bdad729e8cec169cd8f93aacd36d5cabc72d1f1c451a75b91647f336508aca4acf43359a11e9aaa92
7
+ data.tar.gz: be8452dc9cc7f9a39519af9df1c80a678485a10ce22ebc6e3997283befadf1a9c298725ac6fc5ab6a9592d6d40319b6b2f6cc0828342983345a19308fcf8b0cb
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.0.0-p0
1
+ ruby-2.0.0
@@ -13,22 +13,22 @@ class Sexp
13
13
  #
14
14
  # s(:@ident, "test", s(2, 12)
15
15
  # => 2
16
- def line
16
+ def line_number
17
17
  case sexp_type
18
18
  when :def, :defs, :command, :command_call, :call, :fcall, :method_add_arg, :method_add_block,
19
19
  :var_ref, :vcall, :const_ref, :const_path_ref, :class, :module,
20
20
  :if, :unless, :elsif, :ifop, :if_mod, :unless_mod, :binary,
21
21
  :alias, :symbol_literal, :symbol, :aref, :hash, :assoc_new, :string_literal,
22
22
  :massign
23
- self[1].line
23
+ self[1].line_number
24
24
  when :assoclist_from_args, :bare_assoc_hash
25
- self[1][0].line
25
+ self[1][0].line_number
26
26
  when :string_add, :opassign
27
- self[2].line
27
+ self[2].line_number
28
28
  when :array
29
- array_values.first.line
29
+ array_values.first.line_number
30
30
  when :mlhs_add
31
- self.last.line
31
+ self.last.line_number
32
32
  else
33
33
  self.last.first if self.last.is_a? Array
34
34
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module CodeAnalyzer
3
- VERSION = "0.3.2"
3
+ VERSION = "0.4.0"
4
4
  end
@@ -28,47 +28,47 @@ describe Sexp do
28
28
  end
29
29
 
30
30
  it "should return class line" do
31
- @node.grep_node(sexp_type: :class).line.should == 1
31
+ @node.grep_node(sexp_type: :class).line_number.should == 1
32
32
  end
33
33
 
34
34
  it "should return def line" do
35
- @node.grep_node(sexp_type: :def).line.should == 2
35
+ @node.grep_node(sexp_type: :def).line_number.should == 2
36
36
  end
37
37
 
38
38
  it "should return const line" do
39
- @node.grep_node(sexp_type: :const_ref).line.should == 1
39
+ @node.grep_node(sexp_type: :const_ref).line_number.should == 1
40
40
  end
41
41
 
42
42
  it "should return const path line" do
43
- @node.grep_node(sexp_type: :const_path_ref).line.should == 3
43
+ @node.grep_node(sexp_type: :const_path_ref).line_number.should == 3
44
44
  end
45
45
 
46
46
  it "should return alias line" do
47
- @node.grep_node(sexp_type: :alias).line.should == 5
47
+ @node.grep_node(sexp_type: :alias).line_number.should == 5
48
48
  end
49
49
 
50
50
  it "should return hash line" do
51
- @node.grep_node(sexp_type: :hash).line.should == 6
51
+ @node.grep_node(sexp_type: :hash).line_number.should == 6
52
52
  end
53
53
 
54
54
  it "should return massign line" do
55
- @node.grep_node(sexp_type: :massign).line.should == 8
55
+ @node.grep_node(sexp_type: :massign).line_number.should == 8
56
56
  end
57
57
 
58
58
  it "should return opassign line" do
59
- @node.grep_node(sexp_type: :opassign).line.should == 11
59
+ @node.grep_node(sexp_type: :opassign).line_number.should == 11
60
60
  end
61
61
 
62
62
  it "should return if line" do
63
- expect(@node.grep_node(sexp_type: :if).line).to eq 14
63
+ expect(@node.grep_node(sexp_type: :if).line_number).to eq 14
64
64
  end
65
65
 
66
66
  it "should return elsif line" do
67
- expect(@node.grep_node(sexp_type: :elsif).line).to eq 16
67
+ expect(@node.grep_node(sexp_type: :elsif).line_number).to eq 16
68
68
  end
69
69
 
70
70
  it "should return if_mod line" do
71
- expect(@node.grep_node(sexp_type: :if_mod).line).to eq 15
71
+ expect(@node.grep_node(sexp_type: :if_mod).line_number).to eq 15
72
72
  end
73
73
  end
74
74
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-14 00:00:00.000000000 Z
11
+ date: 2013-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sexp_processor
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  requirements: []
110
110
  rubyforge_project:
111
- rubygems_version: 2.0.3
111
+ rubygems_version: 2.0.6
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: a code analyzer helps you build your own code analyzer tool.