Sha256: e7d896d6984d68b6a4995c7bf794e671bdc2ccf15a509b4079056332ec5c4bf2

Contents?: true

Size: 848 Bytes

Versions: 17

Compression:

Stored size: 848 Bytes

Contents

require 'sass/tree/node'

module Sass::Tree
  class CommentNode < Node
    attr_accessor :lines
    attr_accessor :value
    attr_accessor :silent

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

    def ==(other)
      self.class == other.class && value == other.value && silent == other.silent && lines == other.lines
    end

    def to_s(tabs = 0, parent_name = nil)
      return if invisible?

      spaces = '  ' * (tabs - 1)
      spaces + "/* " + ([value] + lines.map {|l| l.text}).
        map{|l| l.sub(%r{ ?\*/ *$},'')}.join(style == :compact ? ' ' : "\n#{spaces} * ") + " */"
    end

    def invisible?
      style == :compressed || @silent
    end

    protected

    def _perform(environment)
      return [] if @silent
      self
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
gohanlonllc-haml-2.1.0.20080513000000 lib/sass/tree/comment_node.rb
gohanlonllc-haml-2.1.0 lib/sass/tree/comment_node.rb
haml-edge-2.1.12 lib/sass/tree/comment_node.rb
haml-edge-2.1.10 lib/sass/tree/comment_node.rb
haml-edge-2.1.11 lib/sass/tree/comment_node.rb
haml-edge-2.1.18 lib/sass/tree/comment_node.rb
haml-edge-2.1.19 lib/sass/tree/comment_node.rb
haml-edge-2.1.20 lib/sass/tree/comment_node.rb
haml-edge-2.1.21 lib/sass/tree/comment_node.rb
haml-edge-2.1.17 lib/sass/tree/comment_node.rb
haml-edge-2.1.14 lib/sass/tree/comment_node.rb
haml-edge-2.1.15 lib/sass/tree/comment_node.rb
haml-edge-2.1.16 lib/sass/tree/comment_node.rb
haml-edge-2.1.13 lib/sass/tree/comment_node.rb
haml-edge-2.1.9 lib/sass/tree/comment_node.rb
haml-edge-2.1.8 lib/sass/tree/comment_node.rb
haml-edge-2.1.7 lib/sass/tree/comment_node.rb