Class: Sass::Script::CssVariableWarning
- Inherits:
- Object
- Object
- Sass::Script::CssVariableWarning
- Defined in:
- /Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/css_variable_warning.rb
Overview
An object tracking whether a warning has been emitted for a given script tree.
This is shared among all objects in a script tree. Whenever any of those objects encounters a situation in which it wouldn’t produce semantically identical CSS to its input, it calls #warn!. The first time #warn! is called for a given warning object, it prints a deprecation warning.
Instance Method Summary (collapse)
- - (CssVariableWarning) initialize constructor
A new instance of CssVariableWarning.
- - value=(value)
Sets the root of the script tree that this warning refers to.
- - warn!
The first time this is called, it prints a deprecation warning.
Constructor Details
- (CssVariableWarning) initialize
Returns a new instance of CssVariableWarning
11 12 13 14 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/css_variable_warning.rb', line 11
def initialize
@warned = false
@value = nil
end |
Instance Method Details
- value=(value)
Sets the root of the script tree that this warning refers to.
19 20 21 22 23 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/css_variable_warning.rb', line 19
def value=(value)
warn_called = @warned && !@value
@value = value
print_warning if warn_called
end |
- warn!
The first time this is called, it prints a deprecation warning.
This may be called before #value=. If it is, the warning is emitted once the script tree is set.
29 30 31 32 33 34 35 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/css_variable_warning.rb', line 29
def warn!
return if @warned
@warned = true
return unless @value
print_warning
end |