Sha256: 533b176d14f02cac9fd47c04dfff3bd46c7e0b6f2134c7441f84155a49d58bfb

Contents?: true

Size: 457 Bytes

Versions: 12

Compression:

Stored size: 457 Bytes

Contents

module Xing::Services
  module Locator

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

    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

    def router
      Rails.application.routes
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
xing-backend-1.0.0.pre.beta lib/xing/services/locator.rb
xing-backend-0.0.25 lib/xing/services/locator.rb
xing-backend-0.0.23 lib/xing/services/locator.rb
xing-backend-0.0.22 lib/xing/services/locator.rb
xing-backend-0.0.21 lib/xing/services/locator.rb
xing-backend-0.0.20 lib/xing/services/locator.rb
xing-backend-0.0.19 lib/xing/services/locator.rb
xing-backend-0.0.18 lib/xing/services/locator.rb
xing-backend-0.0.17 lib/xing/services/locator.rb
xing-backend-0.0.16 lib/xing/services/locator.rb
xing-backend-0.0.15 lib/xing/services/locator.rb
xing-backend-0.0.14 lib/xing/services/locator.rb