Sha256: 466c3d497152b6bf5f8adcdb6f12bb5f0db5f9d19f91c2f65e29787510e011e0
Contents?: true
Size: 1.84 KB
Versions: 1
Compression:
Stored size: 1.84 KB
Contents
# encoding: utf-8 module Axiom class Function class Connective # A logical AND between expressions class Conjunction < Connective include Binary, Binary::Invertible undef_method :inverse # Evaluate the operands using a logical AND # # @example with true operands # Conjunction.call(true, true) # => true # # @example with true and false # Conjunction.call(true, false) # => false # # @example with false and true # Conjunction.call(false, true) # => false # # @example with false and false # Conjunction.call(false, false) # => false # # @param [Boolean] left # @param [Boolean] right # # @return [Boolean] # # @api public def self.call(left, right) left && right end # Return the inverse connective # # @example # disjunction = conjunction.inverse # # @return [Disjunction] # # @api public def inverse Disjunction.new(Negation.new(left), Negation.new(right)) .memoize(:inverse, self) end module Methods extend Aliasable inheritable_alias(:& => :and) # Logically AND the expression with another expression # # @example # conjunction = expression.and(other) # # @param [Function] other # # @return [Conjunction] # # @api public def and(other) Conjunction.new(self, other) end end # module Methods Connective.class_eval { include Methods } memoize :inverse end # class Conjunction end # class Connective end # class Function end # module Axiom
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.1 | lib/axiom/function/connective/conjunction.rb |