4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/ryan/sexp_decorator.rb', line 4
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
|