Class: Sass::Script::Variable
Overview
A SassScript parse node representing a variable.
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
The name of the variable.
Instance Method Summary collapse
-
#initialize(name) ⇒ Variable
constructor
A new instance of Variable.
-
#inspect ⇒ String
A string representation of the variable.
-
#perform(environment) ⇒ Literal
Evaluates the variable.
Constructor Details
#initialize(name) ⇒ Variable
Returns a new instance of Variable.
11 12 13 |
# File 'lib/sass/script/variable.rb', line 11 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ String (readonly)
The name of the variable.
8 9 10 |
# File 'lib/sass/script/variable.rb', line 8 def name @name end |
Instance Method Details
#inspect ⇒ String
Returns A string representation of the variable.
16 17 18 |
# File 'lib/sass/script/variable.rb', line 16 def inspect "!#{name}" end |
#perform(environment) ⇒ Literal
Evaluates the variable.
25 26 27 28 |
# File 'lib/sass/script/variable.rb', line 25 def perform(environment) (val = environment.var(name)) && (return val) raise SyntaxError.new("Undefined variable: \"!#{name}\".") end |