Skip to content

Commit

Permalink
use Proc.new to automatically do parameter checking for us
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed May 23, 2014
1 parent 7c26f01 commit 93ae747
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions actionpack/lib/action_controller/metal.rb
Expand Up @@ -30,10 +30,8 @@ def valid?(action)
end
end

def build(action, app=nil, &block)
app ||= block
def build(action, app = Proc.new)
action = action.to_s
raise "MiddlewareStack#build requires an app" unless app

middlewares.reverse.inject(app) do |a, middleware|
middleware.valid?(action) ? middleware.build(a) : a
Expand Down

0 comments on commit 93ae747

Please sign in to comment.