Class: SunTime
- Inherits:
-
Object
- Object
- SunTime
- Includes:
- DegreeTrig
- Defined in:
- lib/sun_time.rb,
lib/sun_time/degree_trig.rb
Defined Under Namespace
Modules: DegreeTrig Classes: AlwaysDarkError, AlwaysLightError
Constant Summary collapse
- VERSION =
'0.0.1'
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#lat ⇒ Object
readonly
Returns the value of attribute lat.
-
#lng ⇒ Object
readonly
Returns the value of attribute lng.
Instance Method Summary collapse
-
#initialize(date, lat, lng) ⇒ SunTime
constructor
A new instance of SunTime.
- #sunrise ⇒ Object
- #sunset ⇒ Object
Methods included from DegreeTrig
#acos, #asin, #atan, #cos, #d2r, #r2d, #sin, #tan
Constructor Details
#initialize(date, lat, lng) ⇒ SunTime
Returns a new instance of SunTime.
13 14 15 16 17 18 |
# File 'lib/sun_time.rb', line 13 def initialize (date, lat, lng) @date = date @lat = lat @lng = lng @m = nil end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
11 12 13 |
# File 'lib/sun_time.rb', line 11 def date @date end |
#lat ⇒ Object (readonly)
Returns the value of attribute lat.
11 12 13 |
# File 'lib/sun_time.rb', line 11 def lat @lat end |
#lng ⇒ Object (readonly)
Returns the value of attribute lng.
11 12 13 |
# File 'lib/sun_time.rb', line 11 def lng @lng end |
Instance Method Details
#sunrise ⇒ Object
20 21 22 23 24 |
# File 'lib/sun_time.rb', line 20 def sunrise jd2time j_rise rescue AlwaysDarkError, AlwaysLightError nil end |
#sunset ⇒ Object
26 27 28 29 30 |
# File 'lib/sun_time.rb', line 26 def sunset jd2time j_set rescue AlwaysDarkError, AlwaysLightError nil end |