Class Sass::Script::Variable
In: lib/sass/script/variable.rb
Parent: Node
Haml::Util Engine Color SyntaxError UnitConversionError StandardError Node Operation Literal UnaryOperation Funcall Variable Number String Bool EvaluationContext Node\n[lib/sass/css.rb\nlib/sass/tree/node.rb] DebugNode IfNode CommentNode ForNode MixinNode VariableNode ImportNode WhileNode MixinDefNode Repl CSS Environment Lexer Parser PropNode\n[lib/sass/css.rb\nlib/sass/tree/prop_node.rb] DirectiveNode\n[lib/sass/css.rb\nlib/sass/tree/directive_node.rb] RuleNode\n[lib/sass/css.rb\nlib/sass/tree/rule_node.rb] Rack lib/sass/repl.rb lib/sass/css.rb lib/sass/environment.rb lib/sass/error.rb lib/sass/engine.rb lib/sass/script/lexer.rb lib/sass/script/color.rb lib/sass/script/string.rb lib/sass/script/unary_operation.rb lib/sass/script/variable.rb lib/sass/script/funcall.rb lib/sass/script/operation.rb lib/sass/script/bool.rb lib/sass/script/parser.rb lib/sass/script/literal.rb lib/sass/script/node.rb lib/sass/script/number.rb lib/sass/script/functions.rb Functions Script Files lib/sass/tree/while_node.rb lib/sass/tree/if_node.rb lib/sass/tree/mixin_def_node.rb lib/sass/tree/debug_node.rb lib/sass/tree/for_node.rb lib/sass/tree/import_node.rb lib/sass/tree/prop_node.rb lib/sass/tree/node.rb lib/sass/tree/comment_node.rb lib/sass/tree/mixin_node.rb lib/sass/tree/directive_node.rb lib/sass/tree/rule_node.rb lib/sass/tree/variable_node.rb Tree lib/sass/plugin/rack.rb Plugin Sass dot/m_54_0.png

A SassScript parse node representing a variable.

Methods

inspect   new   perform  

Attributes

name  [R]  The name of the variable.

@return [String]

Public Class methods

@param name [String] See \{name}

[Source]

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

Public Instance methods

@return [String] A string representation of the variable

[Source]

    # File lib/sass/script/variable.rb, line 16
16:       def inspect
17:         "!#{name}"
18:       end

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 25
25:       def perform(environment)
26:         (val = environment.var(name)) && (return val)
27:         raise SyntaxError.new("Undefined variable: \"!#{name}\".")
28:       end

[Validate]