Skip to content

Instantly share code, notes, and snippets.

@pvdb
Created March 30, 2011 20:11
Show Gist options
  • Select an option

  • Save pvdb/895200 to your computer and use it in GitHub Desktop.

Select an option

Save pvdb/895200 to your computer and use it in GitHub Desktop.
MethodFinder and irb via .irbrc
#
# https://github.com/citizen428/methodfinder
#
# stick the below snippet in your .irbrc file
# in order to be able to do something like...
#
# irb :001 > ' blegga '.method_finder 'blegga'
# => [:strip, :strip!]
# irb :002 > 'blegga'.method_finder 6
# => [:bytesize, :length, :size]
# irb :003 > _
#
# MAJOR caveat emptor:
#
# http://twitter.com/dkubb/statuses/52840847816933376
#
begin
require 'methodfinder'
class Object
# find the methods that return the given result
def method_finder(result)
MethodFinder.find(self, result)
end
end
rescue LoadError
# noop in case we cannot load the gem
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment