Skip to content

Commit

Permalink
Always define respond_to_missing? when overriding method_missing
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Aug 13, 2012
1 parent 4ba72a6 commit 23cfaf9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/twitter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 23cfaf9

Please sign in to comment.