Class: GoogleStaticMapsHelper::Location
- Inherits:
-
Object
- Object
- GoogleStaticMapsHelper::Location
- Defined in:
- lib/google_static_maps_helper/location.rb
Overview
Represents a location with lat and lng values.
This classed is used internally to back up Markers’ location and Paths’ points.
Defined Under Namespace
Classes: NoLatKey, NoLatMethod, NoLngKey, NoLngMethod
Instance Attribute Summary collapse
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#lng ⇒ Object
Returns the value of attribute lng.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Location
constructor
:call-seq: new(location_object_or_options, *args).
-
#to_url ⇒ Object
Returning the location as a string “lat,lng”.
Constructor Details
#initialize(*args) ⇒ Location
:call-seq:
new(, *args)
Creates a new Location which is used by Marker and Path object to represent it’s locations.
:args
: Either a location which responds to lat or lng, or a Hash which has :lat and :lng keys.
24 25 26 27 28 29 30 31 32 |
# File 'lib/google_static_maps_helper/location.rb', line 24 def initialize(*args) raise ArgumentError, "Must have some arguments." if args.length == 0 if args.first.is_a? Hash extract_location_from_hash!(args.first) else extract_location_from_object(args.shift) end end |
Instance Attribute Details
#lat ⇒ Object
Returns the value of attribute lat.
14 15 16 |
# File 'lib/google_static_maps_helper/location.rb', line 14 def lat @lat end |
#lng ⇒ Object
Returns the value of attribute lng.
14 15 16 |
# File 'lib/google_static_maps_helper/location.rb', line 14 def lng @lng end |
Instance Method Details
#to_url ⇒ Object
Returning the location as a string “lat,lng”
37 38 39 |
# File 'lib/google_static_maps_helper/location.rb', line 37 def to_url # :nodoc: [lat, lng].join(',') end |