Class: UndergroundWeather::Astronomy
- Inherits:
-
Object
- Object
- UndergroundWeather::Astronomy
- Defined in:
- lib/undergroundweather/features/astronomy.rb
Instance Attribute Summary collapse
-
#age_of_moon ⇒ Object
readonly
Returns the value of attribute age_of_moon.
Instance Method Summary collapse
- #illuminated ⇒ Object
-
#initialize(feed) ⇒ Astronomy
constructor
A new instance of Astronomy.
- #sunrise ⇒ Object
- #sunset ⇒ Object
Constructor Details
#initialize(feed) ⇒ Astronomy
Returns a new instance of Astronomy.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/undergroundweather/features/astronomy.rb', line 5 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 |
Instance Attribute Details
#age_of_moon ⇒ Object (readonly)
Returns the value of attribute age_of_moon.
3 4 5 |
# File 'lib/undergroundweather/features/astronomy.rb', line 3 def age_of_moon @age_of_moon end |
Instance Method Details
#illuminated ⇒ Object
18 19 20 |
# File 'lib/undergroundweather/features/astronomy.rb', line 18 def illuminated "#{@raw_illuminated}%" end |
#sunrise ⇒ Object
22 23 24 |
# File 'lib/undergroundweather/features/astronomy.rb', line 22 def sunrise today_at_hour_and_minute(@raw_sunset) end |
#sunset ⇒ Object
26 27 28 |
# File 'lib/undergroundweather/features/astronomy.rb', line 26 def sunset today_at_hour_and_minute(@raw_sunrise) end |