class Micro::Case::Result::Wrapper

Attributes

output[R]

Public Class Methods

new(result) click to toggle source
# File lib/micro/case/result/wrapper.rb, line 9
def initialize(result)
  @result = result
  @output = ::Kind::Undefined

  @__is_unknown = true
end

Public Instance Methods

failure(type = nil) { |result| ... } click to toggle source
# 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) { |result| ... } click to toggle source
# 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() { |result| ... } click to toggle source
# File lib/micro/case/result/wrapper.rb, line 28
def unknown
  @output = yield(@result) if @__is_unknown && undefined_output?
end

Private Instance Methods

result_type?(type) click to toggle source
# File lib/micro/case/result/wrapper.rb, line 44
def result_type?(type)
  type.nil? || @result.type == type
end
set_output(value) click to toggle source
# File lib/micro/case/result/wrapper.rb, line 34
def set_output(value)
  @__is_unknown = false

  @output = value
end
undefined_output?() click to toggle source
# File lib/micro/case/result/wrapper.rb, line 40
def undefined_output?
  ::Kind::Undefined == @output
end