module Raft::Goliath::HashMarshalling
Public Class Methods
hash_to_object(hash, klass)
click to toggle source
# File lib/raft/goliath.rb, line 89 def self.hash_to_object(hash, klass) object = klass.new hash.each_pair do |k, v| object.send("#{k}=", v) end object end
object_to_hash(object, attrs)
click to toggle source
# File lib/raft/goliath.rb, line 97 def self.object_to_hash(object, attrs) attrs.reduce({}) { |hash, attr| hash[attr] = object.send(attr); hash } end