Class: Skywalker::Command
- Inherits:
-
Object
- Object
- Skywalker::Command
- Defined in:
- lib/skywalker/command.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#on_failure ⇒ Object
Returns the value of attribute on_failure.
-
#on_success ⇒ Object
Returns the value of attribute on_success.
Class Method Summary collapse
-
.call(*args) ⇒ Object
Class interface.
Instance Method Summary collapse
-
#call ⇒ Object
Call: runs the transaction and all operations.
-
#initialize(on_success: nil, on_failure: nil) ⇒ Command
constructor
Instantiates command, setting all arguments.
Constructor Details
#initialize(on_success: nil, on_failure: nil) ⇒ Command
Instantiates command, setting all arguments.
16 17 18 19 |
# File 'lib/skywalker/command.rb', line 16 def initialize(on_success: nil, on_failure: nil) self.on_success = on_success self.on_failure = on_failure end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
22 23 24 |
# File 'lib/skywalker/command.rb', line 22 def error @error end |
#on_failure ⇒ Object
Returns the value of attribute on_failure.
22 23 24 |
# File 'lib/skywalker/command.rb', line 22 def on_failure @on_failure end |
#on_success ⇒ Object
Returns the value of attribute on_success.
22 23 24 |
# File 'lib/skywalker/command.rb', line 22 def on_success @on_success end |
Class Method Details
.call(*args) ⇒ Object
Class interface
8 9 10 |
# File 'lib/skywalker/command.rb', line 8 def self.call(*args) new(*args).call end |
Instance Method Details
#call ⇒ Object
Call: runs the transaction and all operations.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/skywalker/command.rb', line 30 def call transaction do execute! confirm_success end rescue Exception => error confirm_failure error end |