Sha256: 1be2641e01cd4cab1a9d5c135caad738cff6b1288468aa49611a17382629165a
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 OR between expressions class Disjunction < Connective include Binary, Binary::Invertible undef_method :inverse # Evaluate the operands using a logical OR # # @example with true operands # Disjunction.call(true, true) # => true # # @example with true and false # Disjunction.call(true, false) # => true # # @example with false and true # Disjunction.call(false, true) # => true # # @example with false and false # Disjunction.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 # conjunction = disjunction.inverse # # @return [Conjunction] # # @api public def inverse Conjunction.new(Negation.new(left), Negation.new(right)). memoize(:inverse, self) end module Methods extend Aliasable inheritable_alias(:| => :or) # Logically OR the expression with another expression # # @example # disjunction = expression.or(other) # # @param [Function] other # # @return [Disjunction] # # @api public def or(other) Disjunction.new(self, other) end end # module Methods Connective.class_eval { include Methods } memoize :inverse end # class Disjunction end # class Connective end # class Function end # module Axiom
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.0 | lib/axiom/function/connective/disjunction.rb |