lib/veritas/function/predicate/enumerable.rb in veritas-0.0.5 vs lib/veritas/function/predicate/enumerable.rb in veritas-0.0.6
- old
+ new
@@ -30,9 +30,28 @@
# @api private
def initialize(left, right)
super(left, Immutable.freeze_object(right))
end
+ # Evaluate the enumerable function using the tuple
+ #
+ # @example
+ # enumerable.call(tuple) # => true or false
+ #
+ # @param [Tuple] tuple
+ # the tuple to pass to #call in the left and right operands
+ #
+ # @return [Boolean]
+ #
+ # @api public
+ def call(tuple)
+ util = self.class
+ util.call(
+ util.extract_value(left, tuple),
+ right.map { |entry| util.extract_value(entry, tuple) }
+ )
+ end
+
end # module Enumerable
end # class Predicate
end # class Function
end # module Veritas