Class: DRG::Decorators::SexpDecorator

Inherits:
Sexp
  • Object
show all
Defined in:
lib/drg/decorators/sexp_decorator.rb

Instance Method Summary collapse

Instance Method Details

#each_sexp_conditionObject



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/drg/decorators/sexp_decorator.rb', line 2

def each_sexp_condition
  return enum_for(__method__) unless block_given?
  each_sexp do |exp|
    next unless exp.is_a?(Sexp)
    if exp.first == :if
      yield exp
    elsif nested_sexp = exp.enum_for(:deep_each).find { |s| s.first == :if }
      yield nested_sexp
    end
  end
end