code_analyzer 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/code_analyzer/sexp.rb +5 -5
- data/lib/code_analyzer/version.rb +1 -1
- data/spec/code_analyzer/sexp_spec.rb +10 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b18a16f794a38af603dcc6036257fb4718bcaf7f
|
4
|
+
data.tar.gz: 194f1c7fd4eeda9b5feb90af63a5c0e695144a06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10840f679ab73b8e69f324be82c95de6eb11d2002ac984528c224923daf06f0c829590b4d47345cf4fe9086d5258c5e66822ed99bb8d52767729fb8920bc8368
|
7
|
+
data.tar.gz: a7222ce5efb0197e63e61bc20e86bbc730275494cd315a890602a0cafccae8abf9582d14578e35da962d5cdc7d2ea8e94f026b86c11f3517cf921a2679480f3c
|
data/lib/code_analyzer/sexp.rb
CHANGED
@@ -737,21 +737,21 @@ class Sexp
|
|
737
737
|
def array_values
|
738
738
|
case sexp_type
|
739
739
|
when :array
|
740
|
-
if nil == self[1] || [:words_new, :qwords_new, :qsymbols_new].include?(self[1].sexp_type)
|
740
|
+
if nil == self[1] || [:words_new, :qwords_new, :symbols_new, :qsymbols_new].include?(self[1].sexp_type)
|
741
741
|
[]
|
742
|
-
elsif [:words_add, :qwords_add, :qsymbols_add].include? self[1].sexp_type
|
742
|
+
elsif [:words_add, :qwords_add, :symbols_add, :qsymbols_add].include? self[1].sexp_type
|
743
743
|
self[1].array_values
|
744
744
|
else
|
745
745
|
arguments.all
|
746
746
|
end
|
747
|
-
when :words_add, :qwords_add, :qsymbols_add
|
747
|
+
when :words_add, :qwords_add, :symbols_add, :qsymbols_add
|
748
748
|
values = []
|
749
749
|
node = self
|
750
750
|
while true
|
751
|
-
if [:words_add, :qwords_add, :qsymbols_add].include? node.sexp_type
|
751
|
+
if [:words_add, :qwords_add, :symbols_add, :qsymbols_add].include? node.sexp_type
|
752
752
|
values.unshift node[2]
|
753
753
|
node = node[1]
|
754
|
-
elsif [:words_new, :qwords_new, :qsymbols_new].include? node.sexp_type
|
754
|
+
elsif [:words_new, :qwords_new, :symbols_new, :qsymbols_new].include? node.sexp_type
|
755
755
|
break
|
756
756
|
end
|
757
757
|
end
|
@@ -579,6 +579,16 @@ describe Sexp do
|
|
579
579
|
end
|
580
580
|
|
581
581
|
if RUBY_VERSION.to_i > 1
|
582
|
+
it "should get array value with array and symbols_add" do
|
583
|
+
node = parse_content("%I(first_name last_name)").grep_node(sexp_type: :array)
|
584
|
+
expect(node.array_values.map(&:to_s)).to eq ["first_name", "last_name"]
|
585
|
+
end
|
586
|
+
|
587
|
+
it "should get empty array value with array and symbols_add" do
|
588
|
+
node = parse_content("%I()").grep_node(sexp_type: :array)
|
589
|
+
expect(node.array_values.map(&:to_s)).to eq []
|
590
|
+
end
|
591
|
+
|
582
592
|
it "should get array value with array and qsymbols_add" do
|
583
593
|
node = parse_content("%i(first_name last_name)").grep_node(sexp_type: :array)
|
584
594
|
expect(node.array_values.map(&:to_s)).to eq ["first_name", "last_name"]
|
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.4.
|
4
|
+
version: 0.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sexp_processor
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.6.12
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: a code analyzer helps you build your own code analyzer tool.
|