lib/lolitra/handler_base.rb in lolitra-0.1.0 vs lib/lolitra/handler_base.rb in lolitra-0.1.1

- old
+ new

@@ -197,21 +197,16 @@ def self.included(base) base.send :extend, MessageClass end - def initialize(hash={}) - hash.each { |key, value| self.send("#{MessageHandler::Helpers.underscore(key)}=", value) } + def initialize(hash={}) + super() + self.replace(hash) end - def to_hash - hash = {} - self.instance_variables.each {|var| hash[var.to_s.delete("@").to_sym] = self.instance_variable_get(var) } - hash - end - def marshall - JSON.generate(to_hash) + JSON.generate(self) end end class FayeBus def initialize(options = {})