Class: UN::Data::QueryResult

Inherits:
Object
  • Object
show all
Defined in:
lib/un/data/response_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ QueryResult

Returns a new instance of QueryResult.



7
8
9
10
11
12
# File 'lib/un/data/response_parser.rb', line 7

def initialize(values)
  @data = {}
  values.each do |key, value|
    @data[key] = value
  end
end

Instance Method Details

#[](key) ⇒ Object



14
15
16
# File 'lib/un/data/response_parser.rb', line 14

def [](key)
  @data[key]
end

#lengthObject



18
19
20
# File 'lib/un/data/response_parser.rb', line 18

def length
  @data.length
end

#to_sObject



22
23
24
25
26
27
28
# File 'lib/un/data/response_parser.rb', line 22

def to_s
  result = ""
  @data.each do |key, value|
    result << "#{key} = #{value}\n"
  end
  result
end