Sha256: 734c45f68e73c8d0cd02b1fdacd21522026060797c8fac8567c67596fbaab7f1
Contents?: true
Size: 621 Bytes
Versions: 4
Compression:
Stored size: 621 Bytes
Contents
require 'delegate' class Ryan::SexpDecorator < DelegateClass(Sexp) def each_sexp_condition return enum_for(__method__) unless block_given? yielded = [] each_sexp do |exp| if exp.first == :if yield exp yielded << exp else nested_sexp = exp.enum_for(:deep_each).select { |s| s.first == :if } nested_sexp.each do |sexp| if yielded.find { |x| x.object_id == sexp.object_id or x.enum_for(:deep_each).find { |xx| xx.object_id == sexp.object_id } }.nil? yield sexp yielded << sexp end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ryan-1.2.1 | lib/ryan/sexp_decorator.rb |
ryan-1.2.0 | lib/ryan/sexp_decorator.rb |
ryan-1.1.0 | lib/ryan/sexp_decorator.rb |
ryan-1.0.0 | lib/ryan/sexp_decorator.rb |