Sha256: bb4821255305f0e663eb01d19508ebc7f371dce463e6e49c98fa748ba47ace13
Contents?: true
Size: 1.7 KB
Versions: 3
Compression:
Stored size: 1.7 KB
Contents
module Veritas module Logic class Connective # A logical OR between expressions class Disjunction < Binary # 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 a string representing the disjunction # # @example # disjunction.inspect # "<Expression1> OR <Expression2>" # # @return [String] # # @api public def inspect "(#{left.inspect} OR #{right.inspect})" end module Methods extend Aliasable inheritable_alias(:| => :or) # Logically OR the expression with another expression # # @example # disjunction = expression.or(other) # # @param [Expression] other # # @return [Disjunction] # # @api public def or(other) Disjunction.new(self, other) end end # module Methods Expression.class_eval { include Methods } end # class Disjunction 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/disjunction.rb |
veritas-0.0.2 | lib/veritas/logic/connective/disjunction.rb |
veritas-0.0.1 | lib/veritas/logic/connective/disjunction.rb |