Skip to content

Instantly share code, notes, and snippets.

@banister
Created November 8, 2012 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save banister/4039101 to your computer and use it in GitHub Desktop.
Save banister/4039101 to your computer and use it in GitHub Desktop.
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