Module: Enumerable
- Defined in:
- lib/gmaps4rails/extensions/enumerable.rb
Instance Method Summary collapse
-
#to_gmaps4rails(&block) ⇒ Object
Scopes on models generate Arrays this method enables short call to the json creation for all elements in the array.
Instance Method Details
#to_gmaps4rails(&block) ⇒ Object
Scopes on models generate Arrays this method enables short call to the json creation for all elements in the array
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/gmaps4rails/extensions/enumerable.rb', line 4 def to_gmaps4rails(&block) output = "[" json_array = [] each do |object| json = Gmaps4rails.create_json(object, &block) json_array << json.to_s unless json.nil? end output << json_array * (",") output << "]" end |