Class Index [+]

Quicksearch

Sass::Tree::VariableNode

A dynamic node representing a variable definition.

@see Sass::Tree

Public Class Methods

new(name, expr, guarded) click to toggle source

@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 (`||=`)

    # 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

_perform(environment) click to toggle source

Loads the new variable value into the environment.

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

  variable and mixin values
    # File lib/sass/tree/variable_node.rb, line 28
28:       def _perform(environment)
29:         return [] if @guarded && !environment.var(@name).nil?
30:         val = @expr.perform(environment)
31:         if @expr.context == :equals && val.is_a?(Sass::Script::String)
32:           val = Sass::Script::String.new(val.value)
33:         end
34:         environment.set_var(@name, val)
35:         []
36:       end
to_src(tabs, opts, fmt) click to toggle source

@see Node#to_src

    # File lib/sass/tree/variable_node.rb, line 20
20:       def to_src(tabs, opts, fmt)
21:         "#{'  ' * tabs}$#{dasherize(@name, opts)}: #{@expr.to_sass(opts)}#{' !default' if @guarded}#{semi fmt}\n"
22:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.