Class: Tretry::Result
- Inherits:
-
Object
- Object
- Tretry::Result
- Defined in:
- lib/tretry/result.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#fails ⇒ Object
readonly
Returns the value of attribute fails.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(error:, fails:, result:) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(error:, fails:, result:) ⇒ Result
Returns a new instance of Result.
4 5 6 7 8 |
# File 'lib/tretry/result.rb', line 4 def initialize(error:, fails:, result:) @error = error @fails = fails @result = result end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
2 3 4 |
# File 'lib/tretry/result.rb', line 2 def error @error end |
#fails ⇒ Object (readonly)
Returns the value of attribute fails.
2 3 4 |
# File 'lib/tretry/result.rb', line 2 def fails @fails end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
2 3 4 |
# File 'lib/tretry/result.rb', line 2 def result @result end |
Instance Method Details
#[](key) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tretry/result.rb', line 10 def [](key) case key when :error error when :fails fails when :result result else raise "Unknown key: #{key}" end end |