Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- ext/hash_array.rb
Overview
These give Hash and Array a common method that returns an array. HTTParty doesn’t know if a particular XML element is expected to be a list, so when it gets one of that element, it returns it as a Hash. So, one can simply call as_array on any part of the XML navigation that is expected to be an array, as such:
response['rsp']['tasks']['list'].as_array.each {|a| }
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol) ⇒ Object
15 16 17 |
# File 'ext/hash_array.rb', line 15 def method_missing(symbol) return self[symbol.to_s] end |
Instance Method Details
#as_array ⇒ Object
13 |
# File 'ext/hash_array.rb', line 13 def as_array; [self]; end |