Rake extensions to Module.

Methods
Public Instance methods
const_missing(const_name)

Check for deprecated uses of top level (i.e. in Object) uses of Rake class names. If someone tries to reference the constant name, display a warning and return the proper object. Using the —classic-namespace command line option will define these constants in Object and avoid this handler.

      # File lib/rake.rb, line 1987
1987:   def const_missing(const_name)
1988:     case const_name
1989:     when :Task
1990:       Rake.application.const_warning(const_name)
1991:       Rake::Task
1992:     when :FileTask
1993:       Rake.application.const_warning(const_name)
1994:       Rake::FileTask
1995:     when :FileCreationTask
1996:       Rake.application.const_warning(const_name)
1997:       Rake::FileCreationTask
1998:     when :RakeApp
1999:       Rake.application.const_warning(const_name)
2000:       Rake::Application
2001:     else
2002:       rake_original_const_missing(const_name)
2003:     end
2004:   end
rake_extension(method) {|| ...}

Check for an existing method in the current class before extending. IF the method already exists, then a warning is printed and the extension is not added. Otherwise the block is yielded and any definitions in the block will take effect.

Usage:

  class String
    rake_extension("xyz") do
      def xyz
        ...
      end
    end
  end
    # File lib/rake.rb, line 62
62:   def rake_extension(method)
63:     if instance_methods.include?(method)
64:       $stderr.puts "WARNING: Possible conflict with Rake extension: #{self}##{method} already exists"
65:     else
66:       yield
67:     end
68:   end