Class: Ldpath::TestSelector
Instance Attribute Summary collapse
-
#delegate ⇒ Object
readonly
Returns the value of attribute delegate.
-
#test ⇒ Object
readonly
Returns the value of attribute test.
Instance Method Summary collapse
- #evaluate(program, uris, context) ⇒ Object
-
#initialize(delegate, test) ⇒ TestSelector
constructor
A new instance of TestSelector.
Methods inherited from Selector
Constructor Details
#initialize(delegate, test) ⇒ TestSelector
Returns a new instance of TestSelector.
5 6 7 8 |
# File 'lib/ldpath/tests.rb', line 5 def initialize(delegate, test) @delegate = delegate @test = test end |
Instance Attribute Details
#delegate ⇒ Object (readonly)
Returns the value of attribute delegate.
3 4 5 |
# File 'lib/ldpath/tests.rb', line 3 def delegate @delegate end |
#test ⇒ Object (readonly)
Returns the value of attribute test.
3 4 5 |
# File 'lib/ldpath/tests.rb', line 3 def test @test end |
Instance Method Details
#evaluate(program, uris, context) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ldpath/tests.rb', line 10 def evaluate(program, uris, context) return to_enum(:evaluate, program, uris, context) unless block_given? entries = delegate.evaluate program, uris, context entries.select do |uri| result = enum_wrap(test.evaluate(program, uri, context)).any? do |x| x end yield uri if result end end |