Class: RubyChartEngine::Input::Coordinates
- Inherits:
-
Object
- Object
- RubyChartEngine::Input::Coordinates
- Defined in:
- lib/ruby_chart_engine/input/coordinates.rb
Instance Attribute Summary collapse
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
Instance Method Summary collapse
-
#initialize(lat:, lon:) ⇒ Coordinates
constructor
Parse coordinates from various formats: - Decimal degrees: { lat: 32.7157, lon: -117.1611 } - Standard text: { lat: ‘32n43’, lon: ‘117w10’ } - Mixed: { lat: 32.7157, lon: ‘117w10’ }.
Constructor Details
#initialize(lat:, lon:) ⇒ Coordinates
Parse coordinates from various formats:
-
Decimal degrees: { lat: 32.7157, lon: -117.1611 }
-
Standard text: { lat: ‘32n43’, lon: ‘117w10’ }
-
Mixed: { lat: 32.7157, lon: ‘117w10’ }
10 11 12 13 |
# File 'lib/ruby_chart_engine/input/coordinates.rb', line 10 def initialize(lat:, lon:) @latitude = parse_coordinate(lat, :lat) @longitude = parse_coordinate(lon, :lon) end |
Instance Attribute Details
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
4 5 6 |
# File 'lib/ruby_chart_engine/input/coordinates.rb', line 4 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
4 5 6 |
# File 'lib/ruby_chart_engine/input/coordinates.rb', line 4 def longitude @longitude end |