Sha256: 30040309696e95ddfe26223729396531f35b923d684eeea173d4ec1b4cea3880
Contents?: true
Size: 1.71 KB
Versions: 3
Compression:
Stored size: 1.71 KB
Contents
module Veritas module Logic class Connective # A logical AND between expressions class Conjunction < Binary # 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 a string representing the conjunction # # @example # conjunction.inspect # "<Expression1> AND <Expression2>" # # @return [String] # # @api public def inspect "(#{left.inspect} AND #{right.inspect})" end module Methods extend Aliasable inheritable_alias(:& => :and) # Logically AND the expression with another expression # # @example # conjunction = expression.and(other) # # @param [Expression] other # # @return [Conjunction] # # @api public def and(other) Conjunction.new(self, other) end end # module Methods Expression.class_eval { include Methods } end # class Conjunction end # class Connective end # module Logic end # module Veritas
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
veritas-0.0.3 | lib/veritas/logic/connective/conjunction.rb |
veritas-0.0.2 | lib/veritas/logic/connective/conjunction.rb |
veritas-0.0.1 | lib/veritas/logic/connective/conjunction.rb |