Sha256: 18d8d61c06538be039c7ff7e281ea13a4c7ad01cf87aabaff154848c36a62008

Contents?: true

Size: 903 Bytes

Versions: 3

Compression:

Stored size: 903 Bytes

Contents

# frozen_string_literal: true

require_relative 'vocabulary'

unless MiniKraken::Core.constants(false).include? :Outcome
  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
end # defined

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mini_kraken-0.1.09 lib/mini_kraken/core/outcome.rb
mini_kraken-0.1.08 lib/mini_kraken/core/outcome.rb
mini_kraken-0.1.07 lib/mini_kraken/core/outcome.rb