Method: MapWKT::Overlay::Polyline#js_output
- Defined in:
- lib/mapwkt/gmap/polyline.rb
#js_output(map_name = nil) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/mapwkt/gmap/polyline.rb', line 4 def js_output (map_name = nil) points = self.geometry.open? ? self.geometry.points : [*self.geometry.points, self.geometry.points.first] path = "[#{points.map {|p| "new google.maps.LatLng(#{p.latitude_f},#{p.longitude_f})" }.join(?,)}]" "new google.maps.Polyline({#{" map: #{map_name}," if map_name} path: #{path} })" end |