Class: Micro::Case::Result::Wrapper
- Inherits:
-
Object
- Object
- Micro::Case::Result::Wrapper
- Defined in:
- lib/micro/case/result/wrapper.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #failure(type = nil) ⇒ Object
-
#initialize(result) ⇒ Wrapper
constructor
A new instance of Wrapper.
- #success(type = nil) ⇒ Object
- #unknown ⇒ Object
Constructor Details
#initialize(result) ⇒ Wrapper
Returns a new instance of Wrapper.
9 10 11 12 13 14 |
# File 'lib/micro/case/result/wrapper.rb', line 9 def initialize(result) @result = result @output = ::Kind::Undefined @__is_unknown = true end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
7 8 9 |
# File 'lib/micro/case/result/wrapper.rb', line 7 def output @output end |
Instance Method Details
#failure(type = nil) ⇒ Object
16 17 18 19 20 |
# File 'lib/micro/case/result/wrapper.rb', line 16 def failure(type = nil) return if @result.success? || !undefined_output? set_output(yield(@result)) if result_type?(type) end |
#success(type = nil) ⇒ Object
22 23 24 25 26 |
# File 'lib/micro/case/result/wrapper.rb', line 22 def success(type = nil) return if @result.failure? || !undefined_output? set_output(yield(@result)) if result_type?(type) end |
#unknown ⇒ Object
28 29 30 |
# File 'lib/micro/case/result/wrapper.rb', line 28 def unknown @output = yield(@result) if @__is_unknown && undefined_output? end |