Method: REXML::QuickPath.function

Defined in:
lib/rexml/quickpath.rb

.function(elements, fname, rest) ⇒ Object



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/rexml/quickpath.rb', line 222

def QuickPath::function( elements, fname, rest )
  args = parse_args( elements, rest )
  Functions.pair = [0, elements.size]
  results = []
  elements.each do |element|
    Functions.pair[0] += 1
    Functions.node = element
    res = Functions.send( fname, *args )
    case res
    when true
      results << element
    when Fixnum
      results << element if Functions.pair[0] == res
    end
  end
  return results
end