Permalink
Browse files

Always define respond_to_missing? when overriding method_missing

  • Loading branch information...
1 parent 4ba72a6 commit 23cfaf9dec4bc58fd9b3fd8366fb0e087c7f1e51 @sferik committed Aug 13, 2012
Showing with 5 additions and 6 deletions.
  1. +5 −6 lib/twitter.rb
View
@@ -16,15 +16,14 @@ def client
end
end
- def respond_to?(method, include_private=false)
- self.client.respond_to?(method, include_private) || super
- end
+ def respond_to_missing?(method_name, include_private=false); client.respond_to?(method_name, include_private); end if RUBY_VERSION >= "1.9"
+ def respond_to?(method_name, include_private=false); client.respond_to?(method_name, include_private) || super; end if RUBY_VERSION < "1.9"
private
- def method_missing(method, *args, &block)
- return super unless self.client.respond_to?(method)
- self.client.send(method, *args, &block)
+ def method_missing(method_name, *args, &block)
+ return super unless client.respond_to?(method_name)
+ client.send(method_name, *args, &block)
end
end

0 comments on commit 23cfaf9

Please sign in to comment.