Class Index [+]

Quicksearch

Sass::Script::Variable

A SassScript parse node representing a variable.

Attributes

name[R]

The name of the variable.

@return [String]

Public Class Methods

new(name) click to toggle source

@param name [String] See {#name}

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

Public Instance Methods

children() click to toggle source

Returns an empty array.

@return [Array] empty @see Node#children

    # File lib/sass/script/variable.rb, line 27
27:       def children
28:         []
29:       end
inspect(opts = {}) click to toggle source

@return [String] A string representation of the variable

    # File lib/sass/script/variable.rb, line 17
17:       def inspect(opts = {})
18:         return "!important" if name == "important"
19:         "$#{dasherize(name, opts)}"
20:       end
Also aliased as: to_sass
to_sass(opts = {}) click to toggle source
Alias for: inspect

Protected Instance Methods

_perform(environment) click to toggle source

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

    # 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

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.