Class: Skywalker::Command

Inherits:
Object
  • Object
show all
Includes:
Acceptable
Defined in:
lib/skywalker/command.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Acceptable

included, #initialize

Instance Attribute Details

#errorObject

Returns the value of attribute error.



23
24
25
# File 'lib/skywalker/command.rb', line 23

def error
  @error
end

#on_failureObject

Returns the value of attribute on_failure.



23
24
25
# File 'lib/skywalker/command.rb', line 23

def on_failure
  @on_failure
end

#on_successObject

Returns the value of attribute on_success.



23
24
25
# File 'lib/skywalker/command.rb', line 23

def on_success
  @on_success
end

Class Method Details

.call(*args) ⇒ Object

Provides a convenient way to call a command without having to instantiate and call.

Since:

  • 1.0.0



18
19
20
# File 'lib/skywalker/command.rb', line 18

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject

Call: runs the transaction and all operations.

Since:

  • 1.0.0



33
34
35
36
37
38
39
40
41
42
# File 'lib/skywalker/command.rb', line 33

def call
  transaction do
    execute!

    confirm_success
  end

rescue Exception => error
  confirm_failure error
end