Class: Ldpath::TapSelector
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#tap ⇒ Object
readonly
Returns the value of attribute tap.
Instance Method Summary collapse
- #evaluate(program, uris, context) ⇒ Object
- #evaluate_one(uri, _context) ⇒ Object
-
#initialize(identifier, tap) ⇒ TapSelector
constructor
A new instance of TapSelector.
Methods inherited from Selector
Constructor Details
#initialize(identifier, tap) ⇒ TapSelector
Returns a new instance of TapSelector.
231 232 233 234 235 236 |
# File 'lib/ldpath/selectors.rb', line 231 def initialize(identifier, tap) @identifier = identifier @tap = tap super end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
229 230 231 |
# File 'lib/ldpath/selectors.rb', line 229 def identifier @identifier end |
#tap ⇒ Object (readonly)
Returns the value of attribute tap.
229 230 231 |
# File 'lib/ldpath/selectors.rb', line 229 def tap @tap end |
Instance Method Details
#evaluate(program, uris, context) ⇒ Object
238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/ldpath/selectors.rb', line 238 def evaluate(program, uris, context) return to_enum(:evaluate, program, uris, context) unless block_given? program.[identifier] = tap.evaluate(program, uris, context).map { |x| RDF::Literal.new(x.to_s).canonicalize.object } enum_wrap(uris).map do |uri| loading program, uri, context enum_flatten_one(evaluate_one(uri, context)).each do |x| yield x unless x.nil? end end end |
#evaluate_one(uri, _context) ⇒ Object
251 252 253 |
# File 'lib/ldpath/selectors.rb', line 251 def evaluate_one(uri, _context) uri end |