Class: Astronoby::LocalSiderealTime
- Inherits:
-
Object
- Object
- Astronoby::LocalSiderealTime
- Defined in:
- lib/astronoby/time/local_sidereal_time.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Class Method Summary collapse
-
.from_gst(gst:, longitude:) ⇒ Object
Source: Title: Practical Astronomy with your Calculator or Spreadsheet Authors: Peter Duffett-Smith and Jonathan Zwart Edition: Cambridge University Press Chapter: 14 - Local sidereal time (LST).
Instance Method Summary collapse
-
#initialize(date:, time:, longitude:) ⇒ LocalSiderealTime
constructor
A new instance of LocalSiderealTime.
-
#to_gst ⇒ Object
Source: Title: Practical Astronomy with your Calculator or Spreadsheet Authors: Peter Duffett-Smith and Jonathan Zwart Edition: Cambridge University Press Chapter: 15 - Converting LST to GST.
Constructor Details
#initialize(date:, time:, longitude:) ⇒ LocalSiderealTime
Returns a new instance of LocalSiderealTime.
21 22 23 24 25 |
# File 'lib/astronoby/time/local_sidereal_time.rb', line 21 def initialize(date:, time:, longitude:) @date = date @time = time @longitude = longitude end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
5 6 7 |
# File 'lib/astronoby/time/local_sidereal_time.rb', line 5 def date @date end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
5 6 7 |
# File 'lib/astronoby/time/local_sidereal_time.rb', line 5 def longitude @longitude end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
5 6 7 |
# File 'lib/astronoby/time/local_sidereal_time.rb', line 5 def time @time end |
Class Method Details
.from_gst(gst:, longitude:) ⇒ Object
Source:
Title: Practical Astronomy with your Calculator or Spreadsheet
Authors: Peter Duffett-Smith and Jonathan Zwart
Edition: Cambridge University Press
Chapter: 14 - Local sidereal time (LST)
12 13 14 15 16 17 18 19 |
# File 'lib/astronoby/time/local_sidereal_time.rb', line 12 def self.from_gst(gst:, longitude:) date = gst.date time = gst.time + longitude.hours time += Constants::HOURS_PER_DAY if time.negative? time -= Constants::HOURS_PER_DAY if time > Constants::HOURS_PER_DAY new(date: date, time: time, longitude: longitude) end |
Instance Method Details
#to_gst ⇒ Object
Source:
Title: Practical Astronomy with your Calculator or Spreadsheet
Authors: Peter Duffett-Smith and Jonathan Zwart
Edition: Cambridge University Press
Chapter: 15 - Converting LST to GST
32 33 34 35 36 37 38 39 |
# File 'lib/astronoby/time/local_sidereal_time.rb', line 32 def to_gst date = @date time = @time - @longitude.hours time += Constants::HOURS_PER_DAY if time.negative? time -= Constants::HOURS_PER_DAY if time > Constants::HOURS_PER_DAY GreenwichSiderealTime.new(date: date, time: time) end |