Class: Astronoby::Observer
- Inherits:
-
Object
- Object
- Astronoby::Observer
- Defined in:
- lib/astronoby/observer.rb
Constant Summary collapse
- DEFAULT_ELEVATION =
0
- DEFAULT_TEMPERATURE =
283.15
- PRESSURE_AT_SEA_LEVEL =
1013.25
- PASCAL_PER_MILLIBAR =
0.01
- EARTH_GRAVITATIONAL_ACCELERATION =
9.80665
- MOLAR_MASS_OF_AIR =
0.0289644
- UNIVERSAL_GAS_CONSTANT =
8.31432
Instance Attribute Summary collapse
-
#elevation ⇒ Object
readonly
Returns the value of attribute elevation.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#pressure ⇒ Object
readonly
Returns the value of attribute pressure.
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(latitude:, longitude:, elevation: DEFAULT_ELEVATION, temperature: DEFAULT_TEMPERATURE, pressure: nil) ⇒ Observer
constructor
A new instance of Observer.
Constructor Details
#initialize(latitude:, longitude:, elevation: DEFAULT_ELEVATION, temperature: DEFAULT_TEMPERATURE, pressure: nil) ⇒ Observer
Returns a new instance of Observer.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/astronoby/observer.rb', line 23 def initialize( latitude:, longitude:, elevation: DEFAULT_ELEVATION, temperature: DEFAULT_TEMPERATURE, pressure: nil ) @latitude = latitude @longitude = longitude @elevation = elevation @temperature = temperature @pressure = pressure || compute_pressure end |
Instance Attribute Details
#elevation ⇒ Object (readonly)
Returns the value of attribute elevation.
13 14 15 |
# File 'lib/astronoby/observer.rb', line 13 def elevation @elevation end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
13 14 15 |
# File 'lib/astronoby/observer.rb', line 13 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
13 14 15 |
# File 'lib/astronoby/observer.rb', line 13 def longitude @longitude end |
#pressure ⇒ Object (readonly)
Returns the value of attribute pressure.
13 14 15 |
# File 'lib/astronoby/observer.rb', line 13 def pressure @pressure end |
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
13 14 15 |
# File 'lib/astronoby/observer.rb', line 13 def temperature @temperature end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
37 38 39 40 41 42 43 44 45 |
# File 'lib/astronoby/observer.rb', line 37 def ==(other) return false unless other.is_a?(self.class) @latitude == other.latitude && @longitude == other.longitude && @elevation == other.elevation && @temperature == other.temperature && @pressure == other.pressure end |
#hash ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/astronoby/observer.rb', line 48 def hash [ self.class, @latitude, @longitude, @elevation, @temperature, @pressure ].hash end |