Class: Sass::Tree::CommentNode

Inherits:
Node show all
Defined in:
lib/sass/tree/comment_node.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #filename, #line

Instance Method Summary collapse

Methods inherited from Node

#<<, #last, #perform, #to_sass

Constructor Details

#initialize(value, options) ⇒ CommentNode

Returns a new instance of CommentNode.



7
8
9
10
# File 'lib/sass/tree/comment_node.rb', line 7

def initialize(value, options)
  @value = value[2..-1].strip
  super(options)
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/sass/tree/comment_node.rb', line 5

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



12
13
14
# File 'lib/sass/tree/comment_node.rb', line 12

def ==(other)
  self.value == other.value && super
end

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



16
17
18
19
20
21
22
# File 'lib/sass/tree/comment_node.rb', line 16

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

  spaces = '  ' * (tabs - 1)
  spaces + "/* " + ([value] + children.map {|c| c.text}).
    join(@style == :compact ? ' ' : "\n#{spaces} * ") + " */"
end