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
permalink #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
Instance Method Details
permalink #inspect ⇒ String
Returns A string representation of the variable.
16 17 18 |
# File 'lib/sass/script/variable.rb', line 16
def inspect
"!#{name}"
end
|
permalink #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
|