Class: Lyra::CommandResult
- Inherits:
-
Object
- Object
- Lyra::CommandResult
- Defined in:
- lib/lyra/command.rb
Overview
Command result
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
Class Method Summary collapse
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(success:, attributes: {}, error: nil, events: []) ⇒ CommandResult
constructor
A new instance of CommandResult.
- #success? ⇒ Boolean
Constructor Details
#initialize(success:, attributes: {}, error: nil, events: []) ⇒ CommandResult
Returns a new instance of CommandResult.
56 57 58 59 60 61 |
# File 'lib/lyra/command.rb', line 56 def initialize(success:, attributes: {}, error: nil, events: []) @success = success @attributes = attributes @error = error @events = events end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
54 55 56 |
# File 'lib/lyra/command.rb', line 54 def attributes @attributes end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
54 55 56 |
# File 'lib/lyra/command.rb', line 54 def error @error end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
54 55 56 |
# File 'lib/lyra/command.rb', line 54 def events @events end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
54 55 56 |
# File 'lib/lyra/command.rb', line 54 def success @success end |
Class Method Details
.failure(error:) ⇒ Object
76 77 78 |
# File 'lib/lyra/command.rb', line 76 def failure(error:) new(success: false, error: error) end |
.success(attributes: {}, events: []) ⇒ Object
72 73 74 |
# File 'lib/lyra/command.rb', line 72 def success(attributes: {}, events: []) new(success: true, attributes: attributes, events: events) end |
Instance Method Details
#failure? ⇒ Boolean
67 68 69 |
# File 'lib/lyra/command.rb', line 67 def failure? !success? end |
#success? ⇒ Boolean
63 64 65 |
# File 'lib/lyra/command.rb', line 63 def success? @success end |