Extended maintenance of Ruby 1.9.3 ended on February 23, 2015. Read more

In Files

  • rake/ext/core.rb
  • rake/ext/module.rb

Module

Core extension library

Rake extensions to Module.

Public Instance Methods

const_missing(const_name) click to toggle source

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 rake/ext/module.rb, line 21
def const_missing(const_name)
  case const_name
  when :Task
    Rake.application.const_warning(const_name)
    Rake::Task
  when :FileTask
    Rake.application.const_warning(const_name)
    Rake::FileTask
  when :FileCreationTask
    Rake.application.const_warning(const_name)
    Rake::FileCreationTask
  when :RakeApp
    Rake.application.const_warning(const_name)
    Rake::Application
  else
    rake_original_const_missing(const_name)
  end
end
            
Also aliased as: rake_original_const_missing
rake_extension(method) click to toggle source

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 rake/ext/core.rb, line 20
def rake_extension(method)
  if method_defined?(method)
    $stderr.puts "WARNING: Possible conflict with Rake extension: #{self}##{method} already exists"
  else
    yield
  end
end
            
rake_original_const_missing(const_name) click to toggle source

Rename the original handler to make it available.

Alias for: const_missing

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.