Class: OsCtld::ContainerControl::Result
- Inherits:
-
Object
- Object
- OsCtld::ContainerControl::Result
- Defined in:
- lib/osctld/container_control/result.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
-
.from_runner(data) ⇒ ContainerControl::Result
Create result from the runner’s output.
Instance Method Summary collapse
-
#initialize(status, data: nil, message: nil, user_runner: false) ⇒ Result
constructor
A new instance of Result.
- #ok? ⇒ Boolean
- #user_runner? ⇒ Boolean
Constructor Details
#initialize(status, data: nil, message: nil, user_runner: false) ⇒ Result
Returns a new instance of Result.
15 16 17 18 19 20 |
# File 'lib/osctld/container_control/result.rb', line 15 def initialize(status, data: nil, message: nil, user_runner: false) @status = status @data = data @message = @user_runner = user_runner end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
13 14 15 |
# File 'lib/osctld/container_control/result.rb', line 13 def data @data end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
13 14 15 |
# File 'lib/osctld/container_control/result.rb', line 13 def @message end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
13 14 15 |
# File 'lib/osctld/container_control/result.rb', line 13 def status @status end |
Class Method Details
.from_runner(data) ⇒ ContainerControl::Result
Create result from the runner’s output
5 6 7 8 9 10 11 |
# File 'lib/osctld/container_control/result.rb', line 5 def self.from_runner(data) if data[:status] new(true, data: data[:output]) else new(false, message: data[:message]) end end |
Instance Method Details
#ok? ⇒ Boolean
22 23 24 |
# File 'lib/osctld/container_control/result.rb', line 22 def ok? status ? true : false end |
#user_runner? ⇒ Boolean
26 27 28 |
# File 'lib/osctld/container_control/result.rb', line 26 def user_runner? @user_runner end |