Method: Selenium::Client::Protocol#string_array_command

Defined in:
lib/selenium/client/protocol.rb

#string_array_command(verb, args = []) ⇒ Object


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/selenium/client/protocol.rb', line 22

def string_array_command(verb, args=[])
  csv = string_command(verb, args)
  token = ""
  tokens = []
  escape = false
  csv.split(//).each do |letter|
    if escape
      token += letter
      escape = false
      next
    end
    case letter
      when '\\'
        escape = true
      when ','
        tokens << token
        token = ""
      else
        token += letter
    end
  end
  tokens << token
  return tokens
end