class Ldpath::RecursivePathSelector

Attributes

property[R]
repeat[R]

Public Class Methods

new(property, repeat) click to toggle source
# File lib/ldpath/selectors.rb, line 136
def initialize(property, repeat)
  @property = property
  @repeat = repeat
end

Public Instance Methods

evaluate(program, uris, context) { |x| ... } click to toggle source
# File lib/ldpath/selectors.rb, line 141
def evaluate(program, uris, context)
  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 do |x|
      yield x
    end
  end
end