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 = nil, test = nil) ⇒ TestSelector
constructor
A new instance of TestSelector.
Methods inherited from Selector
Constructor Details
#initialize(delegate = nil, test = nil) ⇒ TestSelector
Returns a new instance of TestSelector.
7 8 9 10 11 12 |
# File 'lib/ldpath/tests.rb', line 7 def initialize(delegate = nil, test = nil) @delegate = delegate @test = test super end |
Instance Attribute Details
#delegate ⇒ Object (readonly)
Returns the value of attribute delegate.
5 6 7 |
# File 'lib/ldpath/tests.rb', line 5 def delegate @delegate end |
#test ⇒ Object (readonly)
Returns the value of attribute test.
5 6 7 |
# File 'lib/ldpath/tests.rb', line 5 def test @test end |
Instance Method Details
#evaluate(program, uris, context) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ldpath/tests.rb', line 14 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 |