Class: Less2Sass::Less::Tree::VariableNode
- Defined in:
- lib/less2sass/less/tree/variable_node.rb
Overview
A node representing a variable. The Sass representation of it is Sass::Script::Tree:Variable
Instance Attribute Summary collapse
Attributes inherited from Node
#children, #has_children, #has_parent, #line, #parent, #ref_vars
Instance Method Summary collapse
-
#interpolation? ⇒ Boolean
Checks, whether the variable node is an interpolation.
-
#sass_name ⇒ String
Returns the sass specific name property by removing the starting @.
- #to_sass ⇒ Object
Methods inherited from Node
#<<, #==, #contains_variables?, #creates_context?, #each, #get_referenced_variable_names, #initialize, #transform
Constructor Details
This class inherits a constructor from Less2Sass::Less::Tree::Node
Instance Attribute Details
#currentFileInfo ⇒ Hash
12 13 14 |
# File 'lib/less2sass/less/tree/variable_node.rb', line 12 def currentFileInfo @currentFileInfo end |
#index ⇒ Integer
10 11 12 |
# File 'lib/less2sass/less/tree/variable_node.rb', line 10 def index @index end |
#name ⇒ String
8 9 10 |
# File 'lib/less2sass/less/tree/variable_node.rb', line 8 def name @name end |
Instance Method Details
#interpolation? ⇒ Boolean
Checks, whether the variable node is an interpolation
28 29 30 31 32 |
# File 'lib/less2sass/less/tree/variable_node.rb', line 28 def interpolation? return false unless [ElementNode, RuleNode].include?(@parent.class) return !@parent.is_variable_definition? if @parent.is_a?(RuleNode) true end |
#sass_name ⇒ String
Returns the sass specific name property by removing the starting @.
Example:
node.sass_name => "var1"
21 22 23 |
# File 'lib/less2sass/less/tree/variable_node.rb', line 21 def sass_name @name[1..-1] if @name end |
#to_sass ⇒ Object
35 36 37 38 39 |
# File 'lib/less2sass/less/tree/variable_node.rb', line 35 def to_sass variable = node(::Sass::Script::Tree::Variable.new(sass_name), line) variable = node(::Sass::Script::Tree::Interpolation.new(nil, variable, nil, false, false), line) if interpolation? variable end |