Parent

Class/Module Index [+]

Quicksearch

Sass::Tree::CommentNode

A static node representing a Sass comment (silent or loud).

@see Sass::Tree

Attributes

loud[RW]

Whether the comment is loud.

Loud comments start with ! and force the comment to be generated irrespective of compilation settings or the comment syntax used.

@return [Boolean]

silent[RW]

Whether or not the comment is silent (that is, doesn't output to CSS).

@return [Boolean]

value[RW]

The text of the comment, not including `/*` and `*/`.

@return [String]

Public Class Methods

new(value, silent) click to toggle source

@param value [String] See {#value} @param silent [Boolean] See {#silent}

# File lib/sass/tree/comment_node.rb, line 28
def initialize(value, silent)
  @lines = []
  @silent = silent
  @value = normalize_indentation value
  @loud = @value =~ %{^(/[\/\*])?!}
  @value.sub!("#{$1}!", $1.to_s) if @loud
  super()
end

Public Instance Methods

==(other) click to toggle source

Compares the contents of two comments.

@param other [Object] The object to compare with @return [Boolean] Whether or not this node and the other object

are the same
# File lib/sass/tree/comment_node.rb, line 42
def ==(other)
  self.class == other.class && value == other.value && silent == other.silent
end
evaluated?() click to toggle source

Returns whether this comment should be interpolated for dynamic comment generation.

# File lib/sass/tree/comment_node.rb, line 61
def evaluated?
  @loud
end
invisible?() click to toggle source

Returns `true` if this is a silent comment or the current style doesn't render comments.

Comments starting with ! are never invisible (and the ! is removed from the output.)

@return [Boolean]

# File lib/sass/tree/comment_node.rb, line 52
def invisible?
  if @loud
    return false
  else
    @silent || (style == :compressed)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.