Class: DevelopWithPassion::Expander::ArrayVisitorStep

Inherits:
Object
  • Object
show all
Defined in:
lib/developwithpassion_expander/array_visitor_step.rb

Instance Method Summary collapse

Instance Method Details

#run_using(builder) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/developwithpassion_expander/array_visitor_step.rb', line 4

def run_using(builder)
Module.new do
  builder.visitors.each do|visitor|
    define_method(visitor.name) do
      array_var = instance_variable_get("@#{builder.name}")
      array_var.each{|item| visitor.visitor.respond_to?(:run_using) ? visitor.visitor.run_using(item) : item.send(visitor.visitor)}
    end
  end
end
end