Class: Moon::Action::Transfer

Inherits:
Object
  • Object
show all
Defined in:
lib/moon/action/transfer.rb

Overview

The action transfers a value from the given store object and stores it in the given model attribute.

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Transfer

Returns a new instance of Transfer.



5
6
7
8
9
# File 'lib/moon/action/transfer.rb', line 5

def initialize(options)
  from, to = options.values_at :from, :to
  @store_method, @store_key = from
  @model_key, @model_attribute = to
end

Instance Method Details

#perform(context) ⇒ Object



11
12
13
14
15
16
# File 'lib/moon/action/transfer.rb', line 11

def perform(context)
  @context = context
  fetch_value
  store_value
  nil
end