Class: Google::Maps::Static::Items::Base
- Inherits:
-
Object
- Object
- Google::Maps::Static::Items::Base
- Defined in:
- lib/google/maps/static/items/base.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ Base
constructor
A new instance of Base.
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ Base
Returns a new instance of Base.
13 14 15 16 17 18 19 |
# File 'lib/google/maps/static/items/base.rb', line 13 def initialize *args = args. raise GMapper::Error, "One or more locations is required for the feature." if args.empty? @locations = args @item = self.class.name.split('::').last.downcase end |
Instance Method Details
#to_s ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/google/maps/static/items/base.rb', line 21 def to_s raise GMapper::Error, "@item cannot be nil!" if @item.nil? result = .map do |key, value| "#{key.to_s}:#{value.to_s}|" end.join result += @locations.map do |loc| loc.is_a?(Array) ? loc.join(',') : loc.to_s end.join('|') "#{@item}=#{result}" end |