Class: StaticGmaps::Marker

Inherits:
Object
  • Object
show all
Defined in:
lib/static_gmaps.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Marker

Returns a new instance of Marker.



150
151
152
153
154
155
# File 'lib/static_gmaps.rb', line 150

def initialize(options = {})
  self.latitude        = options[:latitude]        || StaticGmaps::default_latitude
  self.longitude       = options[:longitude]       || StaticGmaps::default_longitude
  self.color           = options[:color]           || StaticGmaps::default_color
  self.alpha_character = options[:alpha_character] || StaticGmaps::default_alpha_character
end

Instance Attribute Details

#alpha_characterObject

Returns the value of attribute alpha_character.



145
146
147
# File 'lib/static_gmaps.rb', line 145

def alpha_character
  @alpha_character
end

#colorObject

Returns the value of attribute color.



145
146
147
# File 'lib/static_gmaps.rb', line 145

def color
  @color
end

#latitudeObject

Returns the value of attribute latitude.



145
146
147
# File 'lib/static_gmaps.rb', line 145

def latitude
  @latitude
end

#longitudeObject

Returns the value of attribute longitude.



145
146
147
# File 'lib/static_gmaps.rb', line 145

def longitude
  @longitude
end

Instance Method Details

#url_fragmentObject

Raises:

  • (MissingArgument)


177
178
179
180
181
182
183
184
185
# File 'lib/static_gmaps.rb', line 177

def url_fragment
  raise MissingArgument.new("Latitude must be set before a url_fragment can be generated for Marker.") if !latitude
  raise MissingArgument.new("Longitude must be set before a url_fragment can be generated for Marker.") if !longitude
  x  = ""
  x += "color:#{color}|" if color
  x += "label:#{alpha_character}|" if alpha_character
  x += "#{latitude},#{longitude}"
  return x
end