Module: Travlrmap::Util
- Defined in:
- lib/travlrmap/util.rb
Class Method Summary collapse
- .domain_from_url(url) ⇒ Object
- .kml_style_url(key, type) ⇒ Object
- .point_from_json(json, types) ⇒ Object
- .template_dir ⇒ Object
Class Method Details
.domain_from_url(url) ⇒ Object
11 12 13 14 |
# File 'lib/travlrmap/util.rb', line 11 def self.domain_from_url(url) host = URI.parse(url).host.downcase host.match(/^(en|www)\./) ? host.split(".")[1..-1].join(".") : host end |
.kml_style_url(key, type) ⇒ Object
7 8 9 |
# File 'lib/travlrmap/util.rb', line 7 def self.kml_style_url(key, type) "travlrmap-%s-%s" % [key, type] end |
.point_from_json(json, types) ⇒ Object
16 17 18 |
# File 'lib/travlrmap/util.rb', line 16 def self.point_from_json(json, types) Point.new(json, types, :json) end |
.template_dir ⇒ Object
4 5 6 |
# File 'lib/travlrmap/util.rb', line 4 def self.template_dir File.(File.join(File.dirname(File.(__FILE__)), "..", "..", "views")) end |