Commit 33df3ed3 authored by Robert Speicher's avatar Robert Speicher

Add `respond_to_missing?` for Commit and Repository

As of Ruby 1.9, this is the correct way to handle `respond_to?` for
methods implemented by `method_missing`.

See https://robots.thoughtbot.com/always-define-respond-to-missing-when-overriding
parent 57830201
...@@ -172,10 +172,8 @@ class Commit ...@@ -172,10 +172,8 @@ class Commit
@raw.send(m, *args, &block) @raw.send(m, *args, &block)
end end
def respond_to?(method) def respond_to_missing?(method, include_private = false)
return true if @raw.respond_to?(method) @raw.respond_to?(method, include_private) || super
super
end end
# Truncate sha to 8 characters # Truncate sha to 8 characters
......
...@@ -163,10 +163,8 @@ class Repository ...@@ -163,10 +163,8 @@ class Repository
end end
end end
def respond_to?(method) def respond_to_missing?(method, include_private = false)
return true if raw_repository.respond_to?(method) raw_repository.respond_to?(method, include_private) || super
super
end end
def blob_at(sha, path) def blob_at(sha, path)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment