class Ramverk::Resolver
@private
Constants
- NOT_FOUND_RESPONSE
@private
Attributes
apps[R]
@private
Public Class Methods
new(apps)
click to toggle source
@private
# File lib/ramverk/resolver.rb, line 7 def initialize(apps) @apps = apps end
Public Instance Methods
call(env)
click to toggle source
@private
# File lib/ramverk/resolver.rb, line 12 def call(env) path = env["PATH_INFO"] apps.each do |app_name, (app, pattern, host)| next if host && !host.match?(host(env)) next unless pattern.peek(path) env["ramverk.application"] = app_name.to_s return app.call(env) end NOT_FOUND_RESPONSE end
Private Instance Methods
host(env)
click to toggle source
@private
# File lib/ramverk/resolver.rb, line 33 def host(env) env["ramverk.parsed_host"] ||= begin if (forwarded = env["HTTP_X_FORWARDED_HOST"]) forwarded.split(/,\s?/).last else env["HTTP_HOST"] || env["SERVER_NAME"] || env["SERVER_ADDR"] end end end