Created
November 8, 2012 14:28
-
-
Save banister/4039101 to your computer and use it in GitHub Desktop.
This file contains 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
def remove_all_methods(definition) | |
lines = definition.lines.to_a | |
while idx = lines.find_index { |line, index| method_definition?(line) } | |
method_length = Pry::Code.new(lines).expression_at(idx + 1).lines.count | |
lines.slice!(idx, method_length) | |
end | |
lines.join | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment