Class: StaticGmaps::Marker
- Inherits:
-
Object
- Object
- StaticGmaps::Marker
- Defined in:
- lib/static_gmaps.rb
Overview
Constant Summary collapse
- DEFAULT_LATITUDE =
nil- DEFAULT_LONGITUDE =
nil- DEFAULT_COLOR =
nil- DEFAULT_ALPHA_CHARACTER =
nil- VALID_COLORS =
[ :red, :green, :blue ]
- VALID_ALPHA_CHARACTERS =
[ :a, :b, :c, :d, :e, :f, :g, :h, :i, :j, :k, :l, :m, :n, :o, :p, :q, :r, :s, :t, :u, :v, :w, :x, :y, :z ]
Instance Attribute Summary collapse
-
#alpha_character ⇒ Object
Returns the value of attribute alpha_character.
-
#color ⇒ Object
Returns the value of attribute color.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Marker
constructor
A new instance of Marker.
- #url_fragment ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Marker
Returns a new instance of Marker.
120 121 122 123 124 125 |
# File 'lib/static_gmaps.rb', line 120 def initialize( = {}) self.latitude = [:latitude] || DEFAULT_LATITUDE self.longitude = [:longitude] || DEFAULT_LONGITUDE self.color = [:color] || DEFAULT_COLOR self.alpha_character = [:alpha_character] || DEFAULT_ALPHA_CHARACTER end |
Instance Attribute Details
#alpha_character ⇒ Object
Returns the value of attribute alpha_character.
115 116 117 |
# File 'lib/static_gmaps.rb', line 115 def alpha_character @alpha_character end |
#color ⇒ Object
Returns the value of attribute color.
115 116 117 |
# File 'lib/static_gmaps.rb', line 115 def color @color end |
#latitude ⇒ Object
Returns the value of attribute latitude.
115 116 117 |
# File 'lib/static_gmaps.rb', line 115 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
115 116 117 |
# File 'lib/static_gmaps.rb', line 115 def longitude @longitude end |
Instance Method Details
#url_fragment ⇒ Object
147 148 149 150 151 152 153 154 |
# File 'lib/static_gmaps.rb', line 147 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 = "#{latitude},#{longitude}" x += ",#{color}" if color x += "#{alpha_character}" if alpha_character return x end |