Class: GoogleWeather::Data
- Inherits:
-
Object
- Object
- GoogleWeather::Data
- Defined in:
- lib/google_weather/data.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(data) ⇒ Data
constructor
A new instance of Data.
- #inspect ⇒ Object
- #method_missing(method) ⇒ Object
Constructor Details
#initialize(data) ⇒ Data
Returns a new instance of Data.
5 6 7 |
# File 'lib/google_weather/data.rb', line 5 def initialize(data) @data = data end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
9 10 11 12 |
# File 'lib/google_weather/data.rb', line 9 def method_missing(method) key = data[method.to_s] key && key['data'] end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/google_weather/data.rb', line 3 def data @data end |
Instance Method Details
#inspect ⇒ Object
14 15 16 17 |
# File 'lib/google_weather/data.rb', line 14 def inspect data = @data.inject([]) { |collection, key| collection << "#{key[0]}: #{key[1]['data']}"; collection }.join("\n ") "#<#{self.class}:0x#{object_id}\n #{data}>" end |