Sha256: a8e3e1bf3a17592fe7473118b22bcb7b203c5e9957dfa4c9cc38c7fb24a60248
Contents?: true
Size: 678 Bytes
Versions: 1
Compression:
Stored size: 678 Bytes
Contents
# Fetcher module WeatherFetcher class WeatherData # TODO move to other gem def initialize(h = { }) @h = h @h.keys.each do |k| self.instance_variable_set("@#{k}".to_sym, @h[k]) #send :attr_accessor, k end end # Return Array of WeatherData objects def self.factory(obj) return [ new(obj) ] if obj.kind_of? Hash return factory_from_array(obj) if obj.kind_of? Array end def self.factory_from_array(array = []) ao = Array.new array.each do |a| obj = self.new(a) ao << obj end return ao end attr_reader :temperature, :wind, :time_from, :time_to end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
weather_fetcher-0.0.2 | lib/weather_fetcher/weather_data.rb |