Module: GeoDistance::Extract

Included in:
BearingVector, DirectionVector, GeoDistance
Defined in:
lib/geo_vectors/util/geo_distance.rb

Instance Method Summary collapse

Instance Method Details

#extract_distance(dist) ⇒ Object



110
111
112
113
114
115
116
117
118
119
# File 'lib/geo_vectors/util/geo_distance.rb', line 110

def extract_distance dist
  case dist
  when Fixnum, Float
    dist.km
  when GeoDistance
    dist
  else
    raise ArgumentError, "Could not convert #{dist} to a GeoDistance"
  end
end