[openstreetmap/openstreetmap-website] Rework coordinates to avoid scientific formatting of small numbers (#1566)

Andy Allan notifications at github.com
Fri Jun 23 14:58:20 UTC 2017


gravitystorm commented on this pull request.



>  module GeoRecord
+  # Ensure that when coordinates are printed that they are always in decimal degrees,
+  # and not e.g. 4.0e-05
+  # Unfortunately you can't extend Numeric classes directly (e.g. `Coord < Float`).
+  class Coord < DelegateClass(Float)

Do you mean something like `Coord < Float`? Ruby (or MRI, specifically) doesn't let you do that unfortunately, see e.g. http://www.virtuouscode.com/2011/08/17/you-cant-subclass-integers-in-ruby/ or http://flylib.com/books/en/2.44.1.41/1/  . In short, some built-in classes are special-cased and don't behave like normal ruby classes. The delegate library is there to provide an alternative approach.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/1566#discussion_r123768311
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20170623/9df6d042/attachment.html>


More information about the rails-dev mailing list