Class: ActionFactory::AttributeAssigner

Inherits:
Object
  • Object
show all
Defined in:
lib/action_factory/attribute_assigner.rb

Instance Method Summary collapse

Constructor Details

#initialize(instance) ⇒ AttributeAssigner

Returns a new instance of AttributeAssigner.



6
7
8
# File 'lib/action_factory/attribute_assigner.rb', line 6

def initialize(instance)
  @instance = instance
end

Instance Method Details

#assign(attributes) ⇒ Object



10
11
12
13
14
# File 'lib/action_factory/attribute_assigner.rb', line 10

def assign(attributes)
  attributes.each do |name, value|
    @instance.public_send("#{name}=", value)
  end
end