Class: Ubr::Coordinate
- Inherits:
-
Struct
- Object
- Struct
- Ubr::Coordinate
- Defined in:
- lib/ubr/coordinate.rb
Instance Attribute Summary collapse
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
Class Method Summary collapse
Instance Attribute Details
#latitude ⇒ Object
Returns the value of attribute latitude
4 5 6 |
# File 'lib/ubr/coordinate.rb', line 4 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude
4 5 6 |
# File 'lib/ubr/coordinate.rb', line 4 def longitude @longitude end |
Class Method Details
.parse(text) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/ubr/coordinate.rb', line 7 def parse(text) if text =~ /\A(\-?[\d\.]+),(\-?[\d\.]+)\Z/ Coordinate.new($1.to_f, $2.to_f) else raise "Coordinate must be in format 'latitude,longitude'; #{text.inspect} given" end end |