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 2489
2489:   def const_missing(const_name)
2490:     case const_name
2491:     when :Task
2492:       Rake.application.const_warning(const_name)
2493:       Rake::Task
2494:     when :FileTask
2495:       Rake.application.const_warning(const_name)
2496:       Rake::FileTask
2497:     when :FileCreationTask
2498:       Rake.application.const_warning(const_name)
2499:       Rake::FileCreationTask
2500:     when :RakeApp
2501:       Rake.application.const_warning(const_name)
2502:       Rake::Application
2503:     else
2504:       rake_original_const_missing(const_name)
2505:     end
2506:   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 64
64:   def rake_extension(method)
65:     if method_defined?(method)
66:       $stderr.puts "WARNING: Possible conflict with Rake extension: #{self}##{method} already exists"
67:     else
68:       yield
69:     end
70:   end