Class: Less2Sass::Less::Tree::CommentNode

Inherits:
Node
  • Object
show all
Defined in:
lib/less2sass/less/tree/comment_node.rb

Overview

Represents either a single-line or a block comment Unfortunately, there is no way to find out, whether the comment has been put on a new line or it just continues on the same line as a rule, for instance.

Examples:

color: #fff; //line comment
or
color: #fff;
//line comment

The AST will be absolutely identical in both cases. So let’s come up with a convention:

- line comments will be put on the same line as
  the previous node
- block comments will be put on new lines

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #has_children, #has_parent, #line, #parent, #ref_vars

Instance Method Summary collapse

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

#currentFileInfoObject

Returns the value of attribute currentFileInfo.



23
24
25
# File 'lib/less2sass/less/tree/comment_node.rb', line 23

def currentFileInfo
  @currentFileInfo
end

#isLineCommentObject

Returns the value of attribute isLineComment.



22
23
24
# File 'lib/less2sass/less/tree/comment_node.rb', line 22

def isLineComment
  @isLineComment
end

#valueObject

Returns the value of attribute value.



21
22
23
# File 'lib/less2sass/less/tree/comment_node.rb', line 21

def value
  @value
end

Instance Method Details

#to_sassObject



25
26
27
28
# File 'lib/less2sass/less/tree/comment_node.rb', line 25

def to_sass
  line = line(@isLineComment ? :current : :new)
  node(::Sass::Tree::CommentNode.new([@value], type), line)
end