Module: Xing::Services::Locator

Included in:
Builders::ListBuilder, Mappers::Base
Defined in:
lib/xing/services/locator.rb

Instance Method Summary collapse

Instance Method Details

#normalize_path(path) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/xing/services/locator.rb', line 9

def normalize_path(path)
  path = "/#{path}"
  path.squeeze!('/')
  path.sub!(%r{/+\Z}, '')
  path.gsub!(/(%[a-f0-9]{2})/) { $1.upcase }
  path = '/' if path == ''
  path
end

#route_to(path) ⇒ Object



4
5
6
7
# File 'lib/xing/services/locator.rb', line 4

def route_to(path)
  path = "http://#{BACKEND_SUBDOMAIN}.example.com#{normalize_path(path)}";
  router.recognize_path(path)
end

#routerObject



18
19
20
# File 'lib/xing/services/locator.rb', line 18

def router
  Rails.application.routes
end