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.2'
- MEAN_SOLAR_ANOMALY_DELTA =
0.000001
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.
14 15 16 17 18 19 |
# File 'lib/sun_time.rb', line 14 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.
12 13 14 |
# File 'lib/sun_time.rb', line 12 def date @date end |
#lat ⇒ Object (readonly)
Returns the value of attribute lat.
12 13 14 |
# File 'lib/sun_time.rb', line 12 def lat @lat end |
#lng ⇒ Object (readonly)
Returns the value of attribute lng.
12 13 14 |
# File 'lib/sun_time.rb', line 12 def lng @lng end |
Instance Method Details
#sunrise ⇒ Object
21 22 23 24 25 |
# File 'lib/sun_time.rb', line 21 def sunrise jd2time j_rise rescue AlwaysDarkError, AlwaysLightError nil end |
#sunset ⇒ Object
27 28 29 30 31 |
# File 'lib/sun_time.rb', line 27 def sunset jd2time j_set rescue AlwaysDarkError, AlwaysLightError nil end |