Class: PikoTransaction::CustomCommand
- Defined in:
- lib/piko_transaction/custom_command.rb
Instance Method Summary collapse
- #do ⇒ Object
-
#initialize(do_action = nil, undo_action = nil, &alternative_do_action) ⇒ CustomCommand
constructor
A new instance of CustomCommand.
- #undo ⇒ Object
Methods inherited from Command
#add_failure_callback, #add_success_callback, #name, #to_s
Methods included from Logger
Constructor Details
#initialize(do_action = nil, undo_action = nil, &alternative_do_action) ⇒ CustomCommand
Returns a new instance of CustomCommand.
24 25 26 27 28 |
# File 'lib/piko_transaction/custom_command.rb', line 24 def initialize(do_action = nil, undo_action = nil, &alternative_do_action) super() @do_action = choose_do_action(do_action, alternative_do_action) @undo_action = undo_action end |
Instance Method Details
#do ⇒ Object
30 31 32 |
# File 'lib/piko_transaction/custom_command.rb', line 30 def do execute_do_action ? call_success_callbacks : call_failure_callbacks end |
#undo ⇒ Object
34 35 36 |
# File 'lib/piko_transaction/custom_command.rb', line 34 def undo execute_undo_action end |