Sha256: 160146847a782491e02835fc4ea64758bd0a64a004f6927d56f8cf45912c8a39

Contents?: true

Size: 750 Bytes

Versions: 3

Compression:

Stored size: 750 Bytes

Contents

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?
        self.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

3 entries across 3 versions & 1 rubygems

Version Path
mini_kraken-0.1.04 lib/mini_kraken/core/outcome.rb
mini_kraken-0.1.03 lib/mini_kraken/core/outcome.rb
mini_kraken-0.1.02 lib/mini_kraken/core/outcome.rb