class Sass::Tree::CommentNode
@see Sass::Tree
A static node representing a Sass comment (silent or loud).
def ==(other)
-
(Boolean)
- Whether or not this node and the other object
Parameters:
-
other
(Object
) -- The object to compare with
def ==(other) self.class == other.class && value == other.value && type == other.type end
def initialize(value, type)
-
type
(Symbol
) -- See \{#type} -
value
(Array
) -- See \{#value}
def initialize(value, type) @value = Sass::Util.with_extracted_values(value) {|str| normalize_indentation str} @type = type super() end
def invisible?
-
(Boolean)
-
def invisible? case @type when :loud; false when :silent; true else; style == :compressed end end
def lines
-
(Fixnum)
-
def lines @value.inject(0) do |s, e| next s + e.count("\n") if e.is_a?(String) next s end end
def normalize_indentation(str)
def normalize_indentation(str) ind = str.split("\n").inject(str[/^[ \t]*/].split("")) do |pre, line| line[/^[ \t]*/].split("").zip(pre).inject([]) do |arr, (a, b)| break arr if a != b arr << a end end.join str.gsub(/^#{ind}/, '') end