Class: Sass::Tree::VariableNode
- Defined in:
- lib/sass/tree/variable_node.rb
Overview
A dynamic node representing a variable definition.
Instance Attribute Summary
Attributes inherited from Node
#children, #filename, #line, #options
Instance Method Summary collapse
-
#_perform(environment) ⇒ Object
protected
Loads the new variable value into the environment.
-
#initialize(name, expr, guarded) ⇒ VariableNode
constructor
A new instance of VariableNode.
Methods inherited from Node
#<<, #==, #_to_s, #balance, #interpolate, #invalid_child?, #invisible?, #last, #perform, #perform!, #perform_children, #render, #style, #to_s, #to_sass
Constructor Details
#initialize(name, expr, guarded) ⇒ VariableNode
Returns a new instance of VariableNode.
10 11 12 13 14 15 |
# File 'lib/sass/tree/variable_node.rb', line 10
def initialize(name, expr, guarded)
@name = name
@expr = expr
@guarded = guarded
super()
end
|
Instance Method Details
#_perform(environment) ⇒ Object (protected)
Loads the new variable value into the environment.
23 24 25 26 27 28 29 30 31 |
# File 'lib/sass/tree/variable_node.rb', line 23
def _perform(environment)
if @guarded && environment.var(@name).nil?
environment.set_var(@name, @expr.perform(environment))
elsif !@guarded
environment.set_var(@name, @expr.perform(environment))
end
[]
end
|