module SRL::Unmarshalable::ClassMethods
Public Instance Methods
from_hash(hash = {})
click to toggle source
# File lib/srl/unmarshalable.rb, line 42 def from_hash(hash = {}) obj = new hash.each do |k, v| # Be a good boy and do not overwrite the standard ruby Object.id k = :oid if k.intern == :id next unless obj.respond_to?(k) if obj.respond_to?("#{k}=") obj.send("#{k}=", v) else obj.instance_variable_set(:"@#{k}", v) end end obj end