Class: Ovimap::Generators::HeatmapGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Ovimap::Generators::HeatmapGenerator
show all
- Includes:
- Helpers
- Defined in:
- lib/generators/ovimap/heatmap/heatmap_generator.rb
Constant Summary
collapse
- DATA_SET =
(2..@ending_row).to_a.map {|x|
"{value: #{sheet[x, :A].value}, latitude: #{sheet[x, :B].value}, longitude: #{sheet[x, :C].value}}" }
- CLEANED_DATA =
DATA_SET.to_s.gsub /"/,''
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Helpers
#asset_path, #content_for, #heatmap_options, #js_path, #layouts, #map_select, #map_style, #map_swap, #nokia_script, #pin_options, #stylesheets
Class Method Details
.source_root ⇒ Object
22
23
24
|
# File 'lib/generators/ovimap/heatmap/heatmap_generator.rb', line 22
def self.source_root
@source_root ||= File.expand_path("../templates", __FILE__)
end
|
Instance Method Details
#heatmap ⇒ Object
26
27
28
29
30
31
|
# File 'lib/generators/ovimap/heatmap/heatmap_generator.rb', line 26
def heatmap
insert_into_file "#{js_path}/map.js", "\nvar data = #{CLEANED_DATA};", :after => /HEAT MAP DATA\/\//
insert_into_file "#{js_path}/map.js", "\n#{heatmap_options}", :after => /HEAT MAP OPTIONS\/\//
end
|