Class: Rodakase::Transaction::Matcher
- Inherits:
-
Object
- Object
- Rodakase::Transaction::Matcher
- Defined in:
- lib/rodakase/transaction/matcher.rb
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #failure {|Error.new(result)| ... } ⇒ Object
-
#initialize(result) ⇒ Matcher
constructor
A new instance of Matcher.
- #success {|result.value| ... } ⇒ Object
Constructor Details
#initialize(result) ⇒ Matcher
Returns a new instance of Matcher.
18 19 20 |
# File 'lib/rodakase/transaction/matcher.rb', line 18 def initialize(result) @result = result end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
4 5 6 |
# File 'lib/rodakase/transaction/matcher.rb', line 4 def result @result end |
Instance Method Details
#failure {|Error.new(result)| ... } ⇒ Object
26 27 28 |
# File 'lib/rodakase/transaction/matcher.rb', line 26 def failure(&block) yield(Error.new(result)) if result.failure? end |
#success {|result.value| ... } ⇒ Object
22 23 24 |
# File 'lib/rodakase/transaction/matcher.rb', line 22 def success(&block) yield(result.value) if result.success? end |