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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eedca749e67de08b5317e78516b6924af0f4c3a11427173af95a160caf64f7dc
4
- data.tar.gz: cbf284f0777d728282d6624902e17fdf45822ee7ba19b1d5d4d13372b8032cf8
3
+ metadata.gz: c844635d5c18684cda2ac7e4f9c4c16b89355e557318c94e46a478477c175cb7
4
+ data.tar.gz: 2a47ed8eed3c8a04079e9e4d7b4e4a9aafae882e9fe229c5e96fc8fe5a10c48c
5
5
  SHA512:
6
- metadata.gz: efaadb093a647f2cf7b82d8495894c66af860cc968ce7a9849ef226b37444274f4b642ae7c07c2665bacc5756b183a07862d6d14db83648c7b88ba3ea2238283
7
- data.tar.gz: 641336b028dcdfaec85bf2f1d6da12c0a828552877e703f9ce3446b68057978b30d1c8e5a30416276a31ec9208d1411148f78a27f71fab28972bd0ab119db668
6
+ metadata.gz: 57442025aa03190ad3cabb7f4e39582aeebbda87e960199ba6da07a0857c2b6a832444aea97ae8d755aa37fd658ca4e03cf5b1cd2b59ab11aefa4cb5519bac63
7
+ data.tar.gz: f64e357d7efb923c2f548b44fa8f42bb9136ec36e2f339731637cbecdd8ab9b306a9956ddc572f05b27a0dc74a907fc58d5ad16d71a8bc7c816e581ae300d9c6
@@ -1 +1,3 @@
1
- $^�vƩ�M�w��D�2F��g�h�A�s�uv� 34H%�׆��7��|���5�q��F�a1�ӽ�;Z���e�U�����^Fr��2��2�؋��4��e��c�ŨO�*�� �=�0J��!4�x���C!���k/��"��p�,kA�� �v��:�s����@Q���I��i����WI��E�I�;L�+��wQ�}���"�d�Esp�J�<ʩ�!Af<y�W4��yw�q�\)�3Ӷ�Y�ia�O�@I
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
@@ -1,3 +1,9 @@
1
+ === 4.11.0 / 2018-04-05
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Extended deep_each to skip subtrees if block returns :skip.
6
+
1
7
  === 4.10.1 / 2018-02-15
2
8
 
3
9
  * 1 minor enhancement:
@@ -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
@@ -34,7 +34,7 @@ require "sexp"
34
34
  class SexpProcessor
35
35
 
36
36
  # duh
37
- VERSION = "4.10.1"
37
+ VERSION = "4.11.0"
38
38
 
39
39
  ##
40
40
  # Automatically shifts off the Sexp type before handing the
@@ -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
- result = []
646
- @complex_sexp.deep_each { |s| result << s if s.sexp_type == :if }
647
- assert_equal [:if, :if], result.map { |k, _| k }
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 [:if, :if], @complex_sexp.deep_each.select { |s, _| s == :if }.map { |k, _| k }
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.10.1
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-02-15 00:00:00.000000000 Z
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