class Module

  1. lib/rake/ext/core.rb
  2. lib/rake/ext/module.rb
  3. show all
Parent: module.rb


Core extension library


Rake extensions to Module.


Public Instance

  1. rake_extension
  2. const_missing

External Aliases

rake_original_const_missing -> const_missing

Rename the original handler to make it available.

Public Instance methods

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.


class String
  rake_extension("xyz") do
    def xyz
[show source]
    # File lib/rake/ext/core.rb, line 20
20:   def rake_extension(method)
21:     if method_defined?(method)
22:       $stderr.puts "WARNING: Possible conflict with Rake extension: #{self}##{method} already exists"
23:     else
24:       yield
25:     end
26:   end
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.

[show source]
    # File lib/rake/ext/module.rb, line 21
21:   def const_missing(const_name)
22:     case const_name
23:     when :Task
24:       Rake.application.const_warning(const_name)
25:       Rake::Task
26:     when :FileTask
27:       Rake.application.const_warning(const_name)
28:       Rake::FileTask
29:     when :FileCreationTask
30:       Rake.application.const_warning(const_name)
31:       Rake::FileCreationTask
32:     when :RakeApp
33:       Rake.application.const_warning(const_name)
34:       Rake::Application
35:     else
36:       rake_original_const_missing(const_name)
37:     end
38:   end