Module: Axiom::Function::Binary
- Includes:
- Operation::Binary
- Included in:
- Connective::Conjunction, Connective::Disjunction, Numeric::Binary, Predicate
- Defined in:
- lib/axiom/function/binary.rb
Overview
Mixin for binary functions
Defined Under Namespace
Modules: Invertible
Instance Attribute Summary
Attributes included from Operation::Binary
Instance Method Summary collapse
-
#call(tuple) ⇒ Boolean
Evaluate the binary function using the tuple.
-
#rename(aliases) ⇒ self, Binary
Rename the contained attributes with the provided aliases.
Methods included from Operation::Binary
Instance Method Details
#call(tuple) ⇒ Boolean
Evaluate the binary function using the tuple
21 22 23 24 25 26 27 |
# File 'lib/axiom/function/binary.rb', line 21 def call(tuple) util = self.class util.call( util.extract_value(left, tuple), util.extract_value(right, tuple) ) end |
#rename(aliases) ⇒ self, Binary
TODO:
handle case where left/right are literals
Rename the contained attributes with the provided aliases
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/axiom/function/binary.rb', line 45 def rename(aliases) util = self.class renamed_left = util.rename_attributes(left, aliases) renamed_right = util.rename_attributes(right, aliases) if left.equal?(renamed_left) && right.equal?(renamed_right) self else util.new(renamed_left, renamed_right) end end |