Class: Async::Container::Threaded::Child::Status
- Inherits:
-
Object
- Object
- Async::Container::Threaded::Child::Status
- Defined in:
- lib/async/container/threaded.rb
Overview
A pseudo exit-status wrapper.
Instance Method Summary collapse
-
#as_json ⇒ Object
Convert the status to a hash, suitable for serialization.
-
#initialize(error = nil) ⇒ Status
constructor
Initialise the status.
-
#success? ⇒ Boolean
Whether the status represents a successful outcome.
-
#to_s ⇒ Object
A human readable representation of the status.
Constructor Details
#initialize(error = nil) ⇒ Status
Initialise the status.
245 246 247 |
# File 'lib/async/container/threaded.rb', line 245 def initialize(error = nil) @error = error end |
Instance Method Details
#as_json ⇒ Object
Convert the status to a hash, suitable for serialization.
258 259 260 261 262 263 264 |
# File 'lib/async/container/threaded.rb', line 258 def as_json(...) if @error @error.inspect else true end end |
#success? ⇒ Boolean
Whether the status represents a successful outcome.
251 252 253 |
# File 'lib/async/container/threaded.rb', line 251 def success? @error.nil? end |
#to_s ⇒ Object
A human readable representation of the status.
267 268 269 |
# File 'lib/async/container/threaded.rb', line 267 def to_s "\#<#{self.class} #{success? ? "success" : "failure"}>" end |