Class: SunTime

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#dateObject (readonly)

Returns the value of attribute date.



11
12
13
# File 'lib/sun_time.rb', line 11

def date
  @date
end

#latObject (readonly)

Returns the value of attribute lat.



11
12
13
# File 'lib/sun_time.rb', line 11

def lat
  @lat
end

#lngObject (readonly)

Returns the value of attribute lng.



11
12
13
# File 'lib/sun_time.rb', line 11

def lng
  @lng
end

Instance Method Details

#sunriseObject



20
21
22
23
24
# File 'lib/sun_time.rb', line 20

def sunrise
  jd2time j_rise
rescue AlwaysDarkError, AlwaysLightError
  nil
end

#sunsetObject



26
27
28
29
30
# File 'lib/sun_time.rb', line 26

def sunset
  jd2time j_set
rescue AlwaysDarkError, AlwaysLightError
  nil
end