Method: LSystem::ProductionAdapter#run_generation

Defined in:
lib/l_system/production_adapter.rb

#run_generation(generation) ⇒ Object

Run the specified generation by calling productions for each of its symbols.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/l_system/production_adapter.rb', line 119

def run_generation( generation )

  # Make a new one every time to support self-mutating adapters
  dispatch_table = self.make_dispatch_table

  generation.each_char do |symbol|
    callback = dispatch_table[ symbol ]

    unless callback
      self.log.warn "No production for symbol %p" % [ symbol ]
      next
    end

    self.log.debug "%p -> %p" % [ symbol, callback ]
    callback.call
  end
end