Module: Alf::Algebra::Binary

Included in:
Image, Intersect, Join, Matching, Minus, NotMatching, Union
Defined in:
lib/alf/algebra/support/binary.rb

Overview

Specialization of Operator for operators that work on a binary input

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object

module ClassMethods



18
19
20
21
# File 'lib/alf/algebra/support/binary.rb', line 18

def self.included(mod)
  super
  mod.extend(ClassMethods)
end

Instance Method Details

#common_attributesObject



45
46
47
# File 'lib/alf/algebra/support/binary.rb', line 45

def common_attributes
  @common_attributes ||= common_heading.to_attr_list
end

#common_headingObject



41
42
43
# File 'lib/alf/algebra/support/binary.rb', line 41

def common_heading
  @common_heading ||= (left.heading & right.heading)
end

#leftObject

Returns the left operand



24
25
26
# File 'lib/alf/algebra/support/binary.rb', line 24

def left
  operands.first
end

#rightObject

Returns the right operand



29
30
31
# File 'lib/alf/algebra/support/binary.rb', line 29

def right
  operands.last
end

#with_left(left) ⇒ Object



33
34
35
# File 'lib/alf/algebra/support/binary.rb', line 33

def with_left(left)
  with_operands(left, right)
end

#with_right(right) ⇒ Object



37
38
39
# File 'lib/alf/algebra/support/binary.rb', line 37

def with_right(right)
  with_operands(left, right)
end