class Rack::Host
Constants
- VERSION
Public Class Methods
new(app, options={})
click to toggle source
# File lib/rack/host.rb, line 5 def initialize(app, options={}) @app = app @hosts = options[:hosts] end
Public Instance Methods
call(env)
click to toggle source
# File lib/rack/host.rb, line 10 def call(env) request = Rack::Request.new(env) if @hosts.include?(request.host) @app.call(env) else not_found end end
not_found()
click to toggle source
# File lib/rack/host.rb, line 19 def not_found content = 'Not Found' [404, {'Content-Type' => 'text/html'}, [content]] end