Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use respond_to? rather than arity checks to play nice with method_mis…

…sing proxies

Conflicts:

	lib/sinatra/base.rb
	test/delegator_test.rb
  • Loading branch information...
commit 5fa4a15b8b14684b5772642fe9f6c97389a4f9ad 1 parent fafc797
@rkh rkh authored
Showing with 1 addition and 8 deletions.
  1. +1 −8 lib/sinatra/base.rb
View
9 lib/sinatra/base.rb
@@ -1478,14 +1478,7 @@ def self.delegate(*methods)
methods.each do |method_name|
eval <<-RUBY, binding, '(__DELEGATE__)', 1
def #{method_name}(*args, &b)
- arity = ::Sinatra::Delegator.target.method(#{method_name.inspect}).arity
- if arity < 0 ? args.size < -arity - 1 : args.size != arity
- begin
- return super
- rescue NameError => e
- raise e unless e.message.include? #{method_name.to_s.inspect}
- end
- end
+ return super if respond_to? #{method_name.inspect}
::Sinatra::Application.send(#{method_name.inspect}, *args, &b)
end
private #{method_name.inspect}
Please sign in to comment.
Something went wrong with that request. Please try again.