Sha256: 0c7dad8f6c4e2bba40f470efd28fdc306f48be8fee8437ed9d222314530f5a86

Contents?: true

Size: 778 Bytes

Versions: 2

Compression:

Stored size: 778 Bytes

Contents

# frozen_string_literal: true

require_relative 'vocabulary'

module MiniKraken
  module Core
    class Outcome
      include Vocabulary # Use mix-in module

      # @return [Symbol] One of: :"#s" (success), :"#u" (failure)
      attr_reader :resultant

      def initialize(aResult, aParent = nil)
        init_vocabulary(aParent)
        @resultant = aResult
      end

      def successful?
        resultant == :"#s"
      end

      def ==(other)
        are_equal = false

        if resultant == other.resultant && parent == other.parent &&
           associations == other.associations
          are_equal = true
        end

        are_equal
      end
    end # class

    Failure = Outcome.new(:"#u")
    BasicSuccess = Outcome.new(:"#s")
  end # module
end # module

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mini_kraken-0.1.06 lib/mini_kraken/core/outcome.rb
mini_kraken-0.1.05 lib/mini_kraken/core/outcome.rb