Sha256: 2bb5c34f87b9896f9a080ec95e0f33fdff0ff150d125db20e54617a43aa660bf

Contents?: true

Size: 695 Bytes

Versions: 4

Compression:

Stored size: 695 Bytes

Contents

# TODO: upgrade these to take either regexes or strings

# http://gilesbowkett.blogspot.com/2006/12/smalltalk-cleverness-translated-into.html
# http://gilesbowkett.com/blog_code_samples/122906_seaside_rails/controller.txt
class Object
  def grep_classes(search_term)
    classes = []
    ObjectSpace.each_object {|object| classes << object.name if object.is_a? Class and not object.name.blank?}
    classes.find_all {|klass| klass.downcase.include? search_term.downcase}
  end
end

# http://gilesbowkett.blogspot.com/2007/11/irb-what-was-that-method-again.html
class Object
  def grep_methods(search_term)
    methods.find_all {|method| method.downcase.include? search_term.downcase}
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
utility_belt-1.0.0 lib/language_greps.rb
utility_belt-1.0.1 lib/language_greps.rb
utility_belt-1.0.2 lib/language_greps.rb
utility_belt-1.0.3 lib/language_greps.rb