lib/metacosm/simulation.rb in metacosm-0.2.5 vs lib/metacosm/simulation.rb in metacosm-0.2.6

- old
+ new

@@ -19,12 +19,15 @@ def execute while true if (command=command_queue.pop) apply(command) + sleep 0.001 + else + thread.pass + sleep 0.1 end - sleep 0.01 end end def halt! @conductor_thread.terminate @@ -68,25 +71,22 @@ @handlers ||= {} @handlers[command.class] ||= construct_handler_for(command) end def construct_handler_for(command) - #binding.pry - module_name = command.class.name.deconstantize # || "Object" + module_name = command.class.name.deconstantize module_name = "Object" if module_name.empty? (module_name.constantize). - #Object. const_get(command.class.name.demodulize + "Handler").new - #Object end def listener_for(event) @listeners ||= {} @listeners[event.class] ||= construct_listener_for(event) end def construct_listener_for(event) - module_name = event.class.name.deconstantize # || "Object" + module_name = event.class.name.deconstantize module_name = "Object" if module_name.empty? listener = (module_name.constantize).const_get(event.class.name.demodulize + "Listener").new(self) listener end end