Module: Gobbler::Mappable::ClassMethods

Defined in:
lib/gobbler/mappable.rb

Instance Method Summary collapse

Instance Method Details

#google_maps_url(opts = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/gobbler/mappable.rb', line 16

def google_maps_url(opts = {})
  opts[:size] ||= "1500x1200"
  opts[:sensor] ||= "true"
  url = "http://maps.googleapis.com/maps/api/staticmap?size=#{opts[:size]}"
  url += "&" + valid_locations.map {|c| "markers=color:green%7Clabel:X%7C#{c[0]},#{c[1]}"}.join("&")
  url += "&sensor=#{opts[:sensor]}"
end

#open_map!(opts = {}) ⇒ Object



24
25
26
# File 'lib/gobbler/mappable.rb', line 24

def open_map!(opts = {})
  system "open '#{google_maps_url(opts)}'"
end

#valid_locationsObject



14
# File 'lib/gobbler/mappable.rb', line 14

def valid_locations; list.collect(&:coordinates).reject {|c| c == [nil,nil] || c == [0.0,0.0]}; end