code_analyzer 0.5.4 → 0.5.5
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 +1 -0
- data/lib/code_analyzer/version.rb +1 -1
- data/spec/code_analyzer/sexp_spec.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c37841a3a698b9ce2fa6c4aa80b0a03eb204a4f6ae43e3a0c8d48e78c5f8916
|
4
|
+
data.tar.gz: f4e3b26a9afb7ce80266d590a98e5f838944b9a892a8748374828aa4387aa592
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60042c122b97be0ece07e2898f245430f4ff8d11f61d68008de00f1a37bd8fa4022d33f98f5d3d13c04138afaa4c6ce724ead33be9ead570b8194809742b7eb7
|
7
|
+
data.tar.gz: e4ee8925dadae37e1a594c114a0ddff4e09e2adabdc92621284323bdd2cb9247b4ec0829a252b6e3050dac5453c250b98b61d3b44f513bbae77aa45bac5c5ac1
|
data/lib/code_analyzer/sexp.rb
CHANGED
@@ -706,6 +706,7 @@ class Sexp
|
|
706
706
|
# s(:string_literal, s(:string_add, s(:string_content), s(:@tstring_content, "Richard", s(1, 14))))
|
707
707
|
def value
|
708
708
|
if :assoc_new == sexp_type
|
709
|
+
return nil if self[2].nil?
|
709
710
|
return self[2] if :array == self[2].sexp_type
|
710
711
|
|
711
712
|
self[2].to_s
|
@@ -663,6 +663,14 @@ describe Sexp do
|
|
663
663
|
expect(node.value).to eq 'Richard'
|
664
664
|
end
|
665
665
|
|
666
|
+
it 'should get value for assoc_new' do
|
667
|
+
node =
|
668
|
+
parse_content("add_user :user, first_name:").grep_node(
|
669
|
+
sexp_type: :assoc_new
|
670
|
+
)
|
671
|
+
expect(node.value).to be_nil
|
672
|
+
end
|
673
|
+
|
666
674
|
it 'should get array value for assoc_new' do
|
667
675
|
node =
|
668
676
|
parse_content("add_user :user, name: %w[Richard Huang]").grep_node(
|