Class: Ldpath::FunctionSelector
- Defined in:
- lib/ldpath/selectors.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#fname ⇒ Object
readonly
Returns the value of attribute fname.
Instance Method Summary collapse
- #evaluate(program, uris, context) ⇒ Object
-
#initialize(fname, arguments = []) ⇒ FunctionSelector
constructor
A new instance of FunctionSelector.
Methods inherited from Selector
Constructor Details
#initialize(fname, arguments = []) ⇒ FunctionSelector
Returns a new instance of FunctionSelector.
24 25 26 27 |
# File 'lib/ldpath/selectors.rb', line 24 def initialize(fname, arguments = []) @fname = fname @arguments = Array(arguments) end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
22 23 24 |
# File 'lib/ldpath/selectors.rb', line 22 def arguments @arguments end |
#fname ⇒ Object (readonly)
Returns the value of attribute fname.
22 23 24 |
# File 'lib/ldpath/selectors.rb', line 22 def fname @fname end |
Instance Method Details
#evaluate(program, uris, context) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ldpath/selectors.rb', line 29 def evaluate(program, uris, context) Array(uris).map do |uri| loading program, uri, context args = arguments.map do |i| case i when Selector i.evaluate(program, uri, context) else i end end program.func_call fname, uri, context, *args end.flatten.compact end |