class Sass::Tree::VariableNode
@see Sass::Tree
A dynamic node representing a variable definition.
def _perform(environment)
-
environment
(Sass::Environment
) -- The lexical environment containing
def _perform(environment) return [] if @guarded && !environment.var(@name).nil? val = @expr.perform(environment) if @expr.context == :equals && val.is_a?(Sass::Script::String) val = Sass::Script::String.new(val.value) end environment.set_var(@name, val) [] end
def initialize(name, expr, guarded)
-
guarded
(Boolean
) -- Whether this is a guarded variable assignment (`||=`) -
expr
(Script::Node
) -- The parse tree for the initial variable value -
name
(String
) -- The name of the variable
def initialize(name, expr, guarded) @name = name @expr = expr @guarded = guarded super() end
def to_src(tabs, opts, fmt)
- See: Node#to_src -
def to_src(tabs, opts, fmt) "#{' ' * tabs}$#{dasherize(@name, opts)}: #{@expr.to_sass(opts)}#{' !default' if @guarded}#{semi fmt}\n" end