Skip to content

Commit

Permalink
whitespace errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rtomayko committed Oct 10, 2010
1 parent 2cb17e0 commit b26fd9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions lib/rack/contrib/try_static.rb
@@ -1,13 +1,13 @@
module Rack module Rack


# The Rack::TryStatic middleware delegates requests to Rack::Static middleware # The Rack::TryStatic middleware delegates requests to Rack::Static middleware
# trying to match a static file # trying to match a static file
# #
# Examples # Examples
# #
# use Rack::TryStatic, # use Rack::TryStatic,
# :root => "public", # static files root dir # :root => "public", # static files root dir
# :urls => %w[/], # match all requests # :urls => %w[/], # match all requests
# :try => ['.html', 'index.html', '/index.html'] # try these postfixes sequentially # :try => ['.html', 'index.html', '/index.html'] # try these postfixes sequentially
# #
# uses same options as Rack::Static with extra :try option which is an array # uses same options as Rack::Static with extra :try option which is an array
Expand All @@ -19,7 +19,7 @@ def initialize(app, options)
@app = app @app = app
@try = ['', *options.delete(:try)] @try = ['', *options.delete(:try)]
@static = ::Rack::Static.new( @static = ::Rack::Static.new(
lambda { [404, {}, []] }, lambda { [404, {}, []] },
options) options)
end end


Expand All @@ -29,7 +29,7 @@ def call(env)
@try.each do |path| @try.each do |path|
resp = @static.call(env.merge!({'PATH_INFO' => orig_path + path})) resp = @static.call(env.merge!({'PATH_INFO' => orig_path + path}))
break if 404 != resp[0] && found = resp break if 404 != resp[0] && found = resp
end end
found or @app.call(env.merge!('PATH_INFO' => orig_path)) found or @app.call(env.merge!('PATH_INFO' => orig_path))
end end
end end
Expand Down
6 changes: 3 additions & 3 deletions test/spec_rack_try_static.rb
Expand Up @@ -10,10 +10,10 @@ def request(options = {})
:root => ::File.expand_path(::File.dirname(__FILE__)), :root => ::File.expand_path(::File.dirname(__FILE__)),
}) })


@request = @request =
Rack::MockRequest.new( Rack::MockRequest.new(
Rack::TryStatic.new( Rack::TryStatic.new(
lambda {[200, {}, ["Hello World"]]}, lambda {[200, {}, ["Hello World"]]},
options)) options))
end end


Expand Down

0 comments on commit b26fd9a

Please sign in to comment.