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.
6 7 8 9 |
# File 'lib/ldpath/tests.rb', line 6 def initialize delegate, test @delegate = delegate @test = test end |
Instance Attribute Details
#delegate ⇒ Object (readonly)
Returns the value of attribute delegate.
4 5 6 |
# File 'lib/ldpath/tests.rb', line 4 def delegate @delegate end |
#test ⇒ Object (readonly)
Returns the value of attribute test.
4 5 6 |
# File 'lib/ldpath/tests.rb', line 4 def test @test end |
Instance Method Details
#evaluate(program, uris, context) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/ldpath/tests.rb', line 11 def evaluate program, uris, context entries = delegate.evaluate program, uris, context entries.select do |uri| Array(test.evaluate(program, uri, context)).any? do |x| x end end end |