module Axiom::Function::Predicate::Enumerable
A mixin for predicates matching an enumerable
Public Class Methods
compare_method(enumerable)
click to toggle source
Return the method to test the enumerable with
@param [#cover?, include?] enumerable
@return [Symbol]
@api private
# File lib/axiom/function/predicate/enumerable.rb, line 17 def self.compare_method(enumerable) enumerable.respond_to?(:cover?) ? :cover? : :include? end
Public Instance Methods
call(tuple)
click to toggle source
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
# File lib/axiom/function/predicate/enumerable.rb, line 32 def call(tuple) util = self.class util.call( util.extract_value(left, tuple), right.map { |entry| util.extract_value(entry, tuple) } ) end