Class: Thoreau::Model::Outcome
- Inherits:
-
Object
- Object
- Thoreau::Model::Outcome
- Includes:
- Logging
- Defined in:
- lib/thoreau/model/outcome.rb
Instance Attribute Summary collapse
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #evaluate(result, context) ⇒ Object
-
#initialize(output: nil, exception: nil) ⇒ Outcome
constructor
A new instance of Outcome.
Methods included from Logging
Constructor Details
#initialize(output: nil, exception: nil) ⇒ Outcome
Returns a new instance of Outcome.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/thoreau/model/outcome.rb', line 17 def initialize output: nil, exception: nil if output.is_a?(Proc) @output_proc = output else @output = output end @exception = exception end |
Instance Attribute Details
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
15 16 17 |
# File 'lib/thoreau/model/outcome.rb', line 15 def exception @exception end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
14 15 16 |
# File 'lib/thoreau/model/outcome.rb', line 14 def output @output end |
Instance Method Details
#evaluate(result, context) ⇒ Object
28 29 30 |
# File 'lib/thoreau/model/outcome.rb', line 28 def evaluate(result, context) @output = context.instance_exec(result, &(@output_proc)) if @output_proc end |