Class: StaticRails::DeterminesWhetherToHandleRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/static-rails/determines_whether_to_handle_request.rb

Instance Method Summary collapse

Constructor Details

#initializeDeterminesWhetherToHandleRequest

Returns a new instance of DeterminesWhetherToHandleRequest.



3
4
5
# File 'lib/static-rails/determines_whether_to_handle_request.rb', line 3

def initialize
  @matches_request_to_static_site = MatchesRequestToStaticSite.new
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/static-rails/determines_whether_to_handle_request.rb', line 7

def call(env)
  req = Rack::Request.new(env)

  (req.get? || req.head?) &&
    (StaticRails.config.proxy_requests || StaticRails.config.serve_compiled_assets) &&
    @matches_request_to_static_site.call(req)
end