Sha256: a5228a662e3279d4d502529711fca7420295141f0e5857ffd267e7f4c0ab0083
Contents?: true
Size: 442 Bytes
Versions: 2
Compression:
Stored size: 442 Bytes
Contents
# frozen_string_literal: true module Course class Result attr_reader :failure, :output def initialize(output: nil, failure: nil) @output = output @failure = failure end def failure? !success? end def on_fail yield failure if block_given? && failure? end def success? failure.nil? end def on_success yield output if block_given? && success? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
course-0.2.1 | lib/course/result.rb |
course-0.2.0 | lib/course/result.rb |