Class: Async::Container::Thread::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/async/container/thread.rb

Overview

A pseudo exit-status wrapper.

Instance Method Summary collapse

Constructor Details

#initialize(error = nil) ⇒ Status

Initialise the status.



171
172
173
# File 'lib/async/container/thread.rb', line 171

def initialize(error = nil)
	@error = error
end

Instance Method Details

#success?Boolean

Whether the status represents a successful outcome.

Returns:

  • (Boolean)


177
178
179
# File 'lib/async/container/thread.rb', line 177

def success?
	@error.nil?
end

#to_sObject

A human readable representation of the status.



182
183
184
# File 'lib/async/container/thread.rb', line 182

def to_s
	"\#<#{self.class} #{success? ? "success" : "failure"}>"
end