Class: UN::Data::QueryResult
- Inherits:
-
Object
- Object
- UN::Data::QueryResult
- Defined in:
- lib/un/data/response_parser.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(values) ⇒ QueryResult
constructor
A new instance of QueryResult.
- #length ⇒ Object
- #to_s ⇒ Object
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 |
#length ⇒ Object
18 19 20 |
# File 'lib/un/data/response_parser.rb', line 18 def length @data.length end |
#to_s ⇒ Object
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 |