Method: REXML::QuickPath.parse_args

Defined in:
lib/rexml/quickpath.rb

.parse_args(element, string) ⇒ Object



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/rexml/quickpath.rb', line 240

def QuickPath::parse_args( element, string )
  # /.*?(?:\)|,)/
  arguments = []
  buffer = ""
  while string and string != ""
    c = string[0]
    string.sub!(/^./u, "")
    case c
    when ?,
      # if depth = 1, then we start a new argument
      arguments << evaluate( buffer )
      #arguments << evaluate( string[0..count] )
    when ?(
      # start a new method call
      function( element, buffer, string )
      buffer = ""
    when ?)
      # close the method call and return arguments
      return arguments
    else
      buffer << c
    end
  end
  ""
end