module Ubr::Coordinate

Public Class Methods

parse(text) click to toggle source
# 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