module Axiom::Relation::Operation::Binary::ClassMethods

Public Instance Methods

new(left, right) click to toggle source

Instantiate a new Binary relation

@example

binary = BinaryRelation.new(left, right)

@param [Relation] left @param [Relation] right

@return [Binary]

@api public

Calls superclass method
# File lib/axiom/relation/operation/binary.rb, line 49
def new(left, right)
  assert_sorted_match(left, right)
  super
end

Private Instance Methods

assert_sorted_match(left, right) click to toggle source

Assert that sorted and unsorted relations are not mixed

@param [Relation] left @param [Relation] right

@return [undefined]

@raise [RelationMismatchError]

raised if one relation is sorted and the other is not

@api private

# File lib/axiom/relation/operation/binary.rb, line 67
def assert_sorted_match(left, right)
  if left.directions.empty? != right.directions.empty?
    fail RelationMismatchError, 'both relations must be sorted or neither may be sorted'
  end
end