Created
June 13, 2013 20:59
-
-
Save amiel/5777288 to your computer and use it in GitHub Desktop.
Discover what methods in a class are actually being used. Either use dependency injection or completely replace your object with this one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WhatIsMyPublicApi < BasicObject | |
def initialize(*arguments) | |
method_missing('initialize', *arguments) | |
end | |
def method_missing(method, *arguments) | |
::File.open('what_is_my_public_api.log', 'a') do |f| | |
args = arguments.inspect.gsub(/^\[|\]$/, '') | |
f.write("#{method}(#{args})\n") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment