Class | Sass::Script::Variable
In: | lib/sass/script/variable.rb
Parent: | Node

A SassScript parse node representing a variable.

### Methods

_perform children inspect new to_sass

### Attributes

name | [R] | The name of the variable. @return [String]

### Public Class methods

new(name)

@param name [String] See \{name}

[Source]

        # File lib/sass/script/variable.rb, line 11
    11:       def initialize(name)
    12:         @name = name
    13:         super()
    14:       end

### Public Instance methods

children()

Returns an empty array.

@return [Array<Node>] empty @see Node#children

[Source]

        # File lib/sass/script/variable.rb, line 27
    27:       def children
    28:         []
    29:       end

inspect(opts = {})

@return [String] A string representation of the variable

[Source]

        # File lib/sass/script/variable.rb, line 17
    17:       def inspect(opts = {})
    18:         return "!important" if name == "important"
    19:         "$#{dasherize(name, opts)}"
    20:       end

to_sass(opts = {})

Alias for inspect

### Protected Instance methods

_perform(environment)

Evaluates the variable.

@param environment [Sass::Environment] The environment in which to evaluate the SassScript @return [Literal] The SassScript object that is the value of the variable @raise [Sass::SyntaxError] if the variable is undefined

[Source]

        # File lib/sass/script/variable.rb, line 38
    38:       def _perform(environment)
    39:         raise SyntaxError.new("Undefined variable: \"$#{name}\".") unless val = environment.var(name)
    40:         if val.is_a?(Number)
    41:           val = val.dup
    42:           val.original = nil
    43:         end
    44:         return val
    45:       end

[Validate]