sexp_processor 4.10.1 → 4.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -1
- data.tar.gz.sig +0 -0
- data/History.rdoc +6 -0
- data/lib/sexp.rb +8 -1
- data/lib/sexp_processor.rb +1 -1
- data/test/test_sexp.rb +17 -4
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c844635d5c18684cda2ac7e4f9c4c16b89355e557318c94e46a478477c175cb7
|
4
|
+
data.tar.gz: 2a47ed8eed3c8a04079e9e4d7b4e4a9aafae882e9fe229c5e96fc8fe5a10c48c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57442025aa03190ad3cabb7f4e39582aeebbda87e960199ba6da07a0857c2b6a832444aea97ae8d755aa37fd658ca4e03cf5b1cd2b59ab11aefa4cb5519bac63
|
7
|
+
data.tar.gz: f64e357d7efb923c2f548b44fa8f42bb9136ec36e2f339731637cbecdd8ab9b306a9956ddc572f05b27a0dc74a907fc58d5ad16d71a8bc7c816e581ae300d9c6
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,3 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
{��q�w7��t,.�A\S{�՛}�!es#v��}�,8�m�a��>�A�2̖T���Y#�������M
|
3
|
+
�=�v#p�dl�K�4��]膖H%�Q��+a��(���cr�ѵ�:Nϔ�~v4��|�^��y��ꌭ�:HKe�@��Oev!\cT�c:t��ܺ�pY'��WV,���.�E(9Vʐ)��MG�u��4�b���u��+���\���5(�u�%�`��:�}���A�Eӻy��L�8�����
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
data/lib/sexp.rb
CHANGED
@@ -86,12 +86,19 @@ class Sexp < Array # ZenTest FULL
|
|
86
86
|
|
87
87
|
##
|
88
88
|
# Recursively enumerates the sexp yielding to +block+ for every element.
|
89
|
+
#
|
90
|
+
# Returning :skip will stop traversing that subtree:
|
91
|
+
#
|
92
|
+
# sexp.deep_each do |s|
|
93
|
+
# next :skip if s.sexp_type == :if
|
94
|
+
# # ...
|
95
|
+
# end
|
89
96
|
|
90
97
|
def deep_each &block
|
91
98
|
return enum_for(:deep_each) unless block_given?
|
92
99
|
|
93
100
|
self.each_sexp do |sexp|
|
94
|
-
block[sexp]
|
101
|
+
next if block[sexp] == :skip
|
95
102
|
sexp.deep_each(&block)
|
96
103
|
end
|
97
104
|
end
|
data/lib/sexp_processor.rb
CHANGED
data/test/test_sexp.rb
CHANGED
@@ -641,15 +641,28 @@ class TestSexp < SexpTestCase # ZenTest FULL
|
|
641
641
|
assert_equal 5, s(:a, s(:b, s(:c, s(:d, s(:e))))).depth
|
642
642
|
end
|
643
643
|
|
644
|
+
DEEP_EXP = [:lasgn, :str, :if,
|
645
|
+
:and, :true, :lit,
|
646
|
+
:if, :lvar, :str, :true]
|
647
|
+
|
644
648
|
def test_deep_each
|
645
|
-
|
646
|
-
|
647
|
-
|
649
|
+
act = []
|
650
|
+
|
651
|
+
@complex_sexp.deep_each { |s| act << s }
|
652
|
+
assert_equal DEEP_EXP, act.map { |k, _| k }
|
653
|
+
end
|
654
|
+
|
655
|
+
def test_deep_each_skip
|
656
|
+
exp = DEEP_EXP.first(3) + DEEP_EXP.last(4)
|
657
|
+
act = []
|
658
|
+
|
659
|
+
@complex_sexp.deep_each { |s| next :skip if s.sexp_type == :and; act << s }
|
660
|
+
assert_equal exp, act.map { |k, _| k }
|
648
661
|
end
|
649
662
|
|
650
663
|
def test_deep_each_without_block
|
651
664
|
assert_kind_of Enumerator, @complex_sexp.deep_each
|
652
|
-
assert_equal
|
665
|
+
assert_equal DEEP_EXP, @complex_sexp.deep_each.map(&:first)
|
653
666
|
end
|
654
667
|
|
655
668
|
def test_unary_not
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sexp_processor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
AhXhF6Wi2GTMezlj5jlI5XV7WsJUSwTp/YiVvcmT74ZaCRvexm6EnNhkrvJJ1Xeu
|
30
30
|
V+HB+LYYhXWitInO/eXxDrFB
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2018-
|
32
|
+
date: 2018-04-05 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rdoc
|
metadata.gz.sig
CHANGED
Binary file
|