]> git.openstreetmap.org Git - rails.git/blobdiff - lib/gpx.rb
Credit the whole of UCL, rather than just the Bartlett / VR centre.
[rails.git] / lib / gpx.rb
index 9b93f07f2b5909929abdee3a49a1bbccd80857a4..3ec11c5c475a7b866a666b68a5552994f0ecb73c 100644 (file)
@@ -63,7 +63,7 @@ module GPX
       highlightgc.stroke("#000000")
       highlightgc.fill("#000000")
 
-      images = frames.times.collect do
+      images = Array(frames) do
         Magick::Image.new(width, height) do |image|
           image.background_color = "white"
           image.format = "GIF"
@@ -81,11 +81,11 @@ module GPX
 
         if m > 0
           frames.times do |n|
-            if n == mm
-              gc = highlightgc.dup
-            else
-              gc = linegc.dup
-            end
+            gc = if n == mm
+                   highlightgc.dup
+                 else
+                   linegc.dup
+                 end
 
             gc.line(px, py, oldpx, oldpy)
 
@@ -148,9 +148,7 @@ module GPX
     end
   end
 
-  private
-
-  class TrkPt < Struct.new(:segment, :latitude, :longitude, :altitude, :timestamp)
+  TrkPt = Struct.new(:segment, :latitude, :longitude, :altitude, :timestamp) do
     def valid?
       latitude && longitude && timestamp &&
         latitude >= -90 && latitude <= 90 &&