]> projects.mako.cc - selectricity/blob - vendor/plugins/geokit/lib/geo_kit/defaults.rb
fixed some typos caught in the first usage
[selectricity] / vendor / plugins / geokit / lib / geo_kit / defaults.rb
1 module GeoKit
2   # These defaults are used in GeoKit::Mappable.distance_to and in acts_as_mappable
3   @@default_units = :miles
4   @@default_formula = :sphere
5
6   [:default_units, :default_formula].each do |sym|
7     class_eval <<-EOS, __FILE__, __LINE__
8       def self.#{sym}
9         if defined?(#{sym.to_s.upcase})
10           #{sym.to_s.upcase}
11         else
12           @@#{sym}
13         end
14       end
15
16       def self.#{sym}=(obj)
17         @@#{sym} = obj
18       end
19     EOS
20   end
21 end

Benjamin Mako Hill || Want to submit a patch?