Module: Compass::HasDeprecatedConstantsFromCore

Included in:
Compass, SassExtensions, SassExtensions::Functions
Defined in:
lib/compass/core.rb

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/compass/core.rb', line 19

def self.extended(base)
  new_base = base.name.sub(/^Compass/,"Compass::Core")
  base.class_eval <<-RUBY
    def self.const_missing(const_name)
      puts "cannot find \#{const_name}"
      if #{new_base}.const_defined?(const_name)
        unless Compass::Core.module_deprecation_warning_issued
          Compass::Core.module_deprecation_warning_issued = true
          Compass::Util.compass_warn(
            "DEPRECATED: #{base.name}::\#{const_name} has been moved to " +
            "#{new_base}::\#{const_name}.\\n" +
            "Please update \#{caller[0]}")
        end
        #{new_base}.const_get(const_name)
      end
    end
  RUBY
end