Module: Travlrmap::Util

Defined in:
lib/travlrmap/util.rb

Class Method Summary collapse

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_dirObject



4
5
6
# File 'lib/travlrmap/util.rb', line 4

def self.template_dir
  File.expand_path(File.join(File.dirname(File.expand_path(__FILE__)), "..", "..", "views"))
end