class Course::Result

Attributes

failure[R]
output[R]

Public Class Methods

new(output: nil, failure: nil) click to toggle source
# File lib/course/result.rb, line 7
def initialize(output: nil, failure: nil)
  @output = output
  @failure = failure
end

Public Instance Methods

failure?() click to toggle source
# File lib/course/result.rb, line 12
def failure?
  !success?
end
on_fail() { |failure| ... } click to toggle source
# File lib/course/result.rb, line 16
def on_fail
  yield failure if block_given? && failure?
end
on_success() { |output| ... } click to toggle source
# File lib/course/result.rb, line 24
def on_success
  yield output if block_given? && success?
end
success?() click to toggle source
# File lib/course/result.rb, line 20
def success?
  failure.nil?
end