Method: Ldpath::RecursivePathSelector#evaluate

Defined in:
lib/ldpath/selectors.rb

#evaluate(program, uris, context, &block) ⇒ Object



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/ldpath/selectors.rb', line 163

def evaluate(program, uris, context, &block)
  return to_enum(:evaluate, program, uris, context) unless block_given?

  input = enum_wrap(uris)

  (0..repeat.max).each_with_index do |_i, idx|
    break if input.none? || (repeat.max == Ldpath::Transform::INFINITY && idx > 25) # we're probably lost..

    input = property.evaluate program, input, context

    next unless idx >= repeat.min

    enum_wrap(input).each(&block)
  end
end