Exception: Gold::Outcomes::Outcome

Inherits:
StandardError
  • Object
show all
Defined in:
lib/gold/outcomes.rb

Overview

This is the base class for any outcome. Sub-classes are intended to inherit from this and define whether that outcome is considered ok or not.

If any subclass defines an initialize method, it should call super to ensure the @ok variable is set.

Direct Known Subclasses

Failure, Success

Instance Method Summary collapse

Constructor Details

#initialize(is_ok, message = nil) ⇒ Outcome

Returns a new instance of Outcome.



9
10
11
12
# File 'lib/gold/outcomes.rb', line 9

def initialize(is_ok, message = nil)
  @ok = is_ok
  super(message)
end

Instance Method Details

#ok?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/gold/outcomes.rb', line 14

def ok?
  @ok
end