1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00
haml--haml/lib/sass/tree/comment_node.rb
2009-04-21 18:39:34 -07:00

34 lines
683 B
Ruby

require 'sass/tree/node'
module Sass::Tree
class CommentNode < Node
attr_accessor :value
def initialize(value, options)
@value = value[2..-1].strip
super(options)
end
def ==(other)
self.value == other.value && super
end
def silent?
!!@options[:silent]
end
def to_s(tabs = 0, parent_name = nil)
return if (style == :compressed || silent?)
spaces = ' ' * (tabs - 1)
spaces + "/* " + ([value] + children.map {|c| c.text}).
map{|l| l.sub(%r{ ?\*/ *$},'')}.join(style == :compact ? ' ' : "\n#{spaces} * ") + " */"
end
protected
def _perform(environment)
self
end
end
end