Class: Ovimap::Generators::DisplayGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Ovimap::Generators::DisplayGenerator
show all
- Includes:
- Helpers
- Defined in:
- lib/generators/ovimap/display/display_generator.rb
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
11
12
13
|
# File 'lib/generators/ovimap/display/display_generator.rb', line 11
def self.source_root
@source_root ||= File.expand_path("../templates", __FILE__)
end
|
Instance Method Details
#display ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/generators/ovimap/display/display_generator.rb', line 15
def display
if File.readlines("#{js_path}/map.js").grep(/nokia.maps.map.Display.[A-Z+_]/).any?
gsub_file "#{js_path}/map.js", /map.set\("baseMapType", nokia.maps.map.Display.[A-Z+_]{2,}\);/, "#{map_swap}"
else
insert_into_file "#{js_path}/map.js", "#{map_select}", :after => /MAP TYPE\/\//
end
end
|