Class Sass::Tree::VariableNode
In: lib/sass/tree/variable_node.rb
Parent: Node

A dynamic node representing a variable definition.

@see Sass::Tree

Methods

_perform   new  

Public Class methods

@param name [String] The name of the variable @param expr [Script::Node] The parse tree for the initial variable value @param guarded [Boolean] Whether this is a guarded variable assignment (`||=`)

[Source]

    # File lib/sass/tree/variable_node.rb, line 10
10:       def initialize(name, expr, guarded)
11:         @name = name
12:         @expr = expr
13:         @guarded = guarded
14:         super()
15:       end

Protected Instance methods

Loads the new variable value into the environment.

@param environment [Sass::Environment] The lexical environment containing

  variable and mixin values

[Source]

    # File lib/sass/tree/variable_node.rb, line 23
23:       def _perform(environment)
24:         if @guarded && environment.var(@name).nil?
25:           environment.set_var(@name, @expr.perform(environment))
26:         elsif !@guarded
27:           environment.set_var(@name, @expr.perform(environment))
28:         end
29: 
30:         []
31:       end

[Validate]