Class: Predicator::Visitors::Each

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

Constant Summary

Constants inherited from Visitor

Visitor::DISPATCH_CACHE

Instance Attribute Summary collapse

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/predicator/visitors/each.rb', line 6

def initialize block
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



4
5
6
# File 'lib/predicator/visitors/each.rb', line 4

def block
  @block
end

Instance Method Details

#visit(node) ⇒ Object



10
11
12
13
# File 'lib/predicator/visitors/each.rb', line 10

def visit node
  super
  block.call node
end