Sha256: 26bd5972e43efad5f967b38061982621f260c64f6708c3bc680a3dfd05a761f4
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
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 self.failure(aParent = nil) new(:"#u", aParent) end def self.success(aParent = nil) new(:"#s", aParent) end def failure? resultant != :"#s" end def success? 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 # Remove associations of variables of this environment, if # persistence flag is set to false. def prune! parent.prune(self) end protected def introspect ", @resultant=#{resultant}" end end # class Failure = Outcome.new(:"#u") BasicSuccess = Outcome.new(:"#s") end # module end # module end # defined
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mini_kraken-0.2.04 | lib/mini_kraken/core/outcome.rb |
mini_kraken-0.2.03 | lib/mini_kraken/core/outcome.rb |