lib/metacosm.rb in metacosm-0.2.10 vs lib/metacosm.rb in metacosm-0.2.11

- old
+ new

@@ -20,10 +20,24 @@ end def ==(other) attrs == other.attrs end + + def handler_class_name + self.class.name.demodulize + "Handler" + end + + def handler_module_name + module_name = self.class.name.deconstantize + module_name = "Object" if module_name.empty? + module_name + end + + def self_class_name + self.class.name + end end class Event include PassiveRecord @@ -31,9 +45,23 @@ to_h.keep_if { |k,_| k != :id } end def ==(other) attrs == other.attrs + end + + def listener_class_name + self.class.name.demodulize + "Listener" + end + + def listener_module_name + module_name = self.class.name.deconstantize + module_name = "Object" if module_name.empty? + module_name + end + + def self_class_name + self.class.name end end class EventListener < Struct.new(:simulation) def fire(command)