Sha256: 0c1cbbcfb404e3ddd6122ac0e84afdbce5f2b559742dfb090c926417cf63dc78

Contents?: true

Size: 825 Bytes

Versions: 19

Compression:

Stored size: 825 Bytes

Contents

# fix by Bob Hutchison:
class String
  unless public_method_defined? :blank?
    def blank?
      self !~ /\S/
    end
  end
end

# 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

19 entries across 19 versions & 7 rubygems

Version Path
FreedomCoder-utility_belt-1.1.1.2 lib/utility_belt/language_greps.rb
FreedomCoder-utility_belt-1.1.1 lib/utility_belt/language_greps.rb
akitaonrails-utility_belt-1.0.10 lib/utility_belt/language_greps.rb
akitaonrails-utility_belt-1.0.11 lib/utility_belt/language_greps.rb
akitaonrails-utility_belt-1.0.12 lib/utility_belt/language_greps.rb
mguterl-utility_belt-1.0.7 lib/utility_belt/language_greps.rb
rwilcox-utility_belt-1.0.7 lib/utility_belt/language_greps.rb
rwilcox-utility_belt-1.0.9 lib/utility_belt/language_greps.rb
timocratic-utility_belt-1.0.7.1 lib/utility_belt/language_greps.rb
timocratic-utility_belt-1.0.7.2 lib/utility_belt/language_greps.rb
timocratic-utility_belt-1.0.7.3 lib/utility_belt/language_greps.rb
flyrb-1.0.0.c lib/flyrb/language_greps.rb
flyrb-1.0.0.b lib/flyrb/language_greps.rb
flyrb-1.0.0.a lib/flyrb/language_greps.rb
akitaonrails-utility_belt-1.0.13 lib/utility_belt/language_greps.rb
utility_belt-1.1.0 lib/utility_belt/language_greps.rb
utility_belt-1.0.4 lib/language_greps.rb
utility_belt-1.0.5 lib/language_greps.rb
utility_belt-1.0.6 lib/language_greps.rb