Class: GDA::Visitors::Each

Inherits:
Visitor
  • Object
show all
Defined in:
lib/gda/visitors/each.rb

Instance Method Summary collapse

Methods inherited from Visitor

#accept

Constructor Details

#initialize(block) ⇒ Each

Returns a new instance of Each.



6
7
8
# File 'lib/gda/visitors/each.rb', line 6

def initialize block
  @block = block
end

Instance Method Details

#visit(node) ⇒ Object



10
11
12
13
14
15
# File 'lib/gda/visitors/each.rb', line 10

def visit node
  super
  unless node.nil? || Array === node
    @block.call node
  end
end