Class: Suture::Value::Result
- Inherits:
-
Object
- Object
- Suture::Value::Result
- Defined in:
- lib/suture/value/result.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #errored? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(result_type, value) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(result_type, value) ⇒ Result
Returns a new instance of Result.
12 13 14 15 |
# File 'lib/suture/value/result.rb', line 12 def initialize(result_type, value) @value = value @errored = result_type == :error end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
11 12 13 |
# File 'lib/suture/value/result.rb', line 11 def value @value end |
Class Method Details
.errored(error) ⇒ Object
3 4 5 |
# File 'lib/suture/value/result.rb', line 3 def self.errored(error) new(:error, error) end |
.returned(return_value) ⇒ Object
7 8 9 |
# File 'lib/suture/value/result.rb', line 7 def self.returned(return_value) new(:return_value, return_value) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
21 22 23 |
# File 'lib/suture/value/result.rb', line 21 def ==(other) other.kind_of?(self.class) && other.state == state end |
#errored? ⇒ Boolean
17 18 19 |
# File 'lib/suture/value/result.rb', line 17 def errored? @errored end |
#hash ⇒ Object
27 28 29 |
# File 'lib/suture/value/result.rb', line 27 def hash state.hash end |