Method: EasyTalk::Model::InstanceMethods#to_hash

Defined in:
lib/easy_talk/model.rb

#to_hashObject

Add to_hash method to convert defined properties to hash



79
80
81
82
83
84
85
# File 'lib/easy_talk/model.rb', line 79

def to_hash
  return {} unless self.class.properties

  self.class.properties.each_with_object({}) do |prop, hash|
    hash[prop.to_s] = send(prop)
  end
end