Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/confer/extensions/hash.rb

Instance Method Summary collapse

Instance Method Details

#apply_to(object) ⇒ Object

Public: Iterates through the keys of this hash and for each key sets the attribute of the same name on ‘object`. If a property of the same does not exist, it is silently ignored.

object - The object on which to apply the values of this Hash.



11
12
13
# File 'lib/confer/extensions/hash.rb', line 11

def apply_to(object)
  self.each { |k, v| object.send("#{k}=", v) if object.respond_to? "#{k}=" }
end