Class: Sass::Tree::CommentNode

Inherits:
ValueNode show all
Defined in:
lib/gems/haml-2.0.4/lib/sass/tree/comment_node.rb

Instance Attribute Summary

Attributes inherited from ValueNode

#value

Attributes inherited from Node

#children, #filename, #line

Instance Method Summary collapse

Methods inherited from ValueNode

#to_sass

Methods inherited from Node

#<<, #to_sass

Constructor Details

#initialize(value, style) ⇒ CommentNode

Returns a new instance of CommentNode.



5
6
7
# File 'lib/gems/haml-2.0.4/lib/sass/tree/comment_node.rb', line 5

def initialize(value, style)
  super(value[2..-1].strip, style)
end

Instance Method Details

#to_s(tabs = 0, parent_name = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/gems/haml-2.0.4/lib/sass/tree/comment_node.rb', line 9

def to_s(tabs = 0, parent_name = nil)
  return if @style == :compressed

  spaces = '  ' * (tabs - 1)
  join_string = @style == :compact ? ' ' : "\n#{spaces} * "
  str = "#{spaces}/* #{value}"
  str << join_string unless children.empty?
  str << "#{children.join join_string} */"
  str
end