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.
243 244 245 |
# File 'lib/async/container/threaded.rb', line 243 def initialize(error = nil) @error = error end |
Instance Method Details
#as_json ⇒ Object
Convert the status to a hash, suitable for serialization.
256 257 258 259 260 261 262 |
# File 'lib/async/container/threaded.rb', line 256 def as_json(...) if @error @error.inspect else true end end |
#success? ⇒ Boolean
Whether the status represents a successful outcome.
249 250 251 |
# File 'lib/async/container/threaded.rb', line 249 def success? @error.nil? end |
#to_s ⇒ Object
A human readable representation of the status.
265 266 267 |
# File 'lib/async/container/threaded.rb', line 265 def to_s "\#<#{self.class} #{success? ? "success" : "failure"}>" end |