Methods
Public Instance methods
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.rb, line 2223 2223: def const_missing(const_name) 2224: case const_name 2225: when :Task 2226: Rake.application.const_warning(const_name) 2227: Rake::Task 2228: when :FileTask 2229: Rake.application.const_warning(const_name) 2230: Rake::FileTask 2231: when :FileCreationTask 2232: Rake.application.const_warning(const_name) 2233: Rake::FileCreationTask 2234: when :RakeApp 2235: Rake.application.const_warning(const_name) 2236: Rake::Application 2237: else 2238: rake_original_const_missing(const_name) 2239: end 2240: end
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
[ show source ]
# File lib/rake.rb, line 60 60: def rake_extension(method) 61: if instance_methods.include?(method.to_s) || instance_methods.include?(method.to_sym) 62: $stderr.puts "WARNING: Possible conflict with Rake extension: #{self}##{method} already exists" 63: else 64: yield 65: end 66: end