Module: Alf::Algebra::Binary
- 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
-
.included(mod) ⇒ Object
module ClassMethods.
Instance Method Summary collapse
- #common_attributes ⇒ Object
- #common_heading ⇒ Object
-
#left ⇒ Object
Returns the left operand.
-
#right ⇒ Object
Returns the right operand.
- #with_left(left) ⇒ Object
- #with_right(right) ⇒ Object
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_attributes ⇒ Object
45 46 47 |
# File 'lib/alf/algebra/support/binary.rb', line 45 def common_attributes @common_attributes ||= common_heading.to_attr_list end |
#common_heading ⇒ Object
41 42 43 |
# File 'lib/alf/algebra/support/binary.rb', line 41 def common_heading @common_heading ||= (left.heading & right.heading) end |
#left ⇒ Object
Returns the left operand
24 25 26 |
# File 'lib/alf/algebra/support/binary.rb', line 24 def left operands.first end |
#right ⇒ Object
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 |