Module: Axiom::Function::Predicate::Enumerable
Overview
A mixin for predicates matching an enumerable
Class Method Summary collapse
-
.compare_method(enumerable) ⇒ Symbol
private
Return the method to test the enumerable with.
Instance Method Summary collapse
-
#call(tuple) ⇒ Boolean
Evaluate the enumerable function using the tuple.
Class Method Details
.compare_method(enumerable) ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the method to test the enumerable with
17 18 19 |
# File 'lib/axiom/function/predicate/enumerable.rb', line 17 def self.compare_method(enumerable) enumerable.respond_to?(:cover?) ? :cover? : :include? end |
Instance Method Details
#call(tuple) ⇒ Boolean
Evaluate the enumerable function using the tuple
32 33 34 35 36 37 38 |
# 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 |