module Evesync::IPC::Data::Hashable

The class, that includes it must implement method *initialize(params)* This is a MUST BE requirement

Public Instance Methods

to_hash() click to toggle source
# 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