Sha256: 26dda6467af819efd40b080529158e119b4cee1e116bbd6e602c0f79c0882f63
Contents?: true
Size: 856 Bytes
Versions: 3
Compression:
Stored size: 856 Bytes
Contents
module UndergroundWeather class Astronomy attr_reader :age_of_moon def initialize(feed) phase = feed['moon_phase'] @age_of_moon = phase['ageOfMoon'] @raw_illuminated = phase['percentIlluminated'] @raw_sunrise = { :hour => phase['sunrise']['hour'], :minute => phase['sunrise']['minute'] } @raw_sunset = { :hour => phase['sunset']['hour'], :minute => phase['sunset']['minute'] } @now = Time.new end def illuminated "#{@raw_illuminated}%" end def sunrise today_at_hour_and_minute(@raw_sunset) end def sunset today_at_hour_and_minute(@raw_sunrise) end private def today_at_hour_and_minute(time = {}) Time.new(@now.year, @now.month, @now.day, time[:hour], time[:minute]) end end end
Version data entries
3 entries across 3 versions & 1 rubygems