Method: TNetstring.parse_dictionary

Defined in:
lib/tnetstring.rb

.parse_dictionary(data) ⇒ Object

:nodoc:

[View source]

72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/tnetstring.rb', line 72

def self.parse_dictionary(data) # :nodoc:
  return {} if data.length == 0

  key, value, extra = parse_pair(data)
  result = {key => value}

  while extra.length > 0
      key, value, extra = parse_pair(extra)
      result[key] = value
  end
  result
end