diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-05-23 18:38:44 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-06-10 01:31:27 -0400 |
commit | 33df3ed384563b1e302e5a4f2186b156c35bafc5 (patch) | |
tree | 275dcc47727c3958aec3cc8a7f4d1849031e7601 /app/models/commit.rb | |
parent | 57830201a9152b56ccf65a98275601617f44653d (diff) | |
download | gitlab-ce-33df3ed384563b1e302e5a4f2186b156c35bafc5.tar.gz |
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
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index f02fe240540..9d721661629 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -172,10 +172,8 @@ class Commit @raw.send(m, *args, &block) end - def respond_to?(method) - return true if @raw.respond_to?(method) - - super + def respond_to_missing?(method, include_private = false) + @raw.respond_to?(method, include_private) || super end # Truncate sha to 8 characters |