Class: Sass::Script::Tree::Variable
- Inherits:
-
Node
- Object
- Node
- Sass::Script::Tree::Variable
- Defined in:
- .ruby-sass/lib/sass/script/tree/variable.rb
Overview
A SassScript parse node representing a variable.
Instance Attribute Summary (collapse)
-
#name ⇒ String
readonly
The name of the variable.
-
#underscored_name ⇒ String
readonly
The underscored name of the variable.
Attributes inherited from Node
#filename, #line, #options, #source_range
Instance Method Summary (collapse)
-
#children ⇒ Array<Node>
Returns an empty array.
- #deep_copy ⇒ Object
-
#initialize(name) ⇒ Variable
constructor
A new instance of Variable.
-
#inspect(opts = {}) ⇒ String
(also: #to_sass)
A string representation of the variable.
Methods inherited from Node
Constructor Details
#initialize(name) ⇒ Variable
Returns a new instance of Variable
15 16 17 18 19 |
# File '.ruby-sass/lib/sass/script/tree/variable.rb', line 15 def initialize(name) @name = name @underscored_name = name.tr("-", "_") super() end |
Constructor Details
#initialize(name) ⇒ Variable
Returns a new instance of Variable
15 16 17 18 19 |
# File '.ruby-sass/lib/sass/script/tree/variable.rb', line 15 def initialize(name) @name = name @underscored_name = name.tr("-", "_") super() end |
Instance Attribute Details
#name ⇒ String (readonly)
The name of the variable.
7 8 9 |
# File '.ruby-sass/lib/sass/script/tree/variable.rb', line 7 def name @name end |
#underscored_name ⇒ String (readonly)
The underscored name of the variable.
12 13 14 |
# File '.ruby-sass/lib/sass/script/tree/variable.rb', line 12 def underscored_name @underscored_name end |
Instance Method Details
#children ⇒ Array<Node>
Returns an empty array.
31 32 33 |
# File '.ruby-sass/lib/sass/script/tree/variable.rb', line 31 def children [] end |
#deep_copy ⇒ Object
36 37 38 |
# File '.ruby-sass/lib/sass/script/tree/variable.rb', line 36 def deep_copy dup end |
#inspect(opts = {}) ⇒ String Also known as: to_sass
Returns A string representation of the variable
22 23 24 |
# File '.ruby-sass/lib/sass/script/tree/variable.rb', line 22 def inspect(opts = {}) "$#{dasherize(name, opts)}" end |