Class: Moon::Action::Models::Updater::Model
- Inherits:
-
Object
- Object
- Moon::Action::Models::Updater::Model
- Defined in:
- lib/moon/action/models/updater.rb
Overview
Model updater.
Instance Method Summary collapse
-
#initialize(model, parameters = { }) ⇒ Model
constructor
A new instance of Model.
- #update ⇒ Object
Constructor Details
#initialize(model, parameters = { }) ⇒ Model
Returns a new instance of Model.
16 17 18 |
# File 'lib/moon/action/models/updater.rb', line 16 def initialize(model, parameters = { }) @model, @parameters = model, parameters end |
Instance Method Details
#update ⇒ Object
20 21 22 23 24 25 |
# File 'lib/moon/action/models/updater.rb', line 20 def update @parameters.each do |key, value| method_name = "#{key}=".to_sym @model.send method_name, value if @model.respond_to?(method_name) end end |