Module: Evesync::IPC::Data::Hashable
Overview
The class, that includes it must implement method *initialize(params)* This is a MUST BE requirement
Instance Method Summary collapse
Instance Method Details
#to_hash ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/evesync/ipc/data/hashable.rb', line 12 def to_hash hash = {} instance_variables.each do |var| value = instance_variable_get(var) if value.respond_to? :to_hash # FIXME: if it wasn't implemented it'll be an error # for a complex type hash[var] = value.to_hash hash[var]['type'] = value.class.to_s else hash[var] = value end hash['type'] = self.class.to_s end Log.debug("IPC Data message hash created: #{hash}") hash end |