Class: Kommando::CommandResult::Success
- Inherits:
-
Object
- Object
- Kommando::CommandResult::Success
- Defined in:
- lib/kommando/command_result.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #deconstruct_keys(_) ⇒ Object
- #error ⇒ Object
- #error? ⇒ Boolean
-
#initialize(value) ⇒ Success
constructor
A new instance of Success.
- #success? ⇒ Boolean
Constructor Details
#initialize(value) ⇒ Success
Returns a new instance of Success.
18 19 20 21 22 |
# File 'lib/kommando/command_result.rb', line 18 def initialize(value) raise ArgumentError, 'missing `:command` key' unless value.key?(:command) raise ArgumentError, 'missing `:parameters` key' unless value.key?(:parameters) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
16 17 18 |
# File 'lib/kommando/command_result.rb', line 16 def value @value end |
Instance Method Details
#deconstruct_keys(_) ⇒ Object
36 37 38 |
# File 'lib/kommando/command_result.rb', line 36 def deconstruct_keys(_) { value: @value[:command] }.merge(@value) end |
#error ⇒ Object
24 25 26 |
# File 'lib/kommando/command_result.rb', line 24 def error raise NonExistentError, 'Success results do not have errors' end |
#error? ⇒ Boolean
32 33 34 |
# File 'lib/kommando/command_result.rb', line 32 def error? false end |
#success? ⇒ Boolean
28 29 30 |
# File 'lib/kommando/command_result.rb', line 28 def success? true end |