Class: Sass::Tree::CommentNode
- Defined in:
- lib/sass/tree/comment_node.rb
Instance Attribute Summary collapse
-
#lines ⇒ Object
Returns the value of attribute lines.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Node
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(value, options) ⇒ CommentNode
constructor
A new instance of CommentNode.
- #invisible? ⇒ Boolean
- #silent? ⇒ Boolean
- #to_s(tabs = 0, parent_name = nil) ⇒ Object
Methods inherited from Node
#<<, #last, #perform, #to_sass
Constructor Details
#initialize(value, options) ⇒ CommentNode
Returns a new instance of CommentNode.
8 9 10 11 12 |
# File 'lib/sass/tree/comment_node.rb', line 8 def initialize(value, ) @lines = [] @value = value[2..-1].strip super() end |
Instance Attribute Details
#lines ⇒ Object
Returns the value of attribute lines.
5 6 7 |
# File 'lib/sass/tree/comment_node.rb', line 5 def lines @lines end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/sass/tree/comment_node.rb', line 6 def value @value end |
Instance Method Details
#==(other) ⇒ Object
14 15 16 |
# File 'lib/sass/tree/comment_node.rb', line 14 def ==(other) self.class == other.class && value == other.value && lines == other.lines end |
#invisible? ⇒ Boolean
30 31 32 |
# File 'lib/sass/tree/comment_node.rb', line 30 def invisible? @style == :compressed || silent? end |
#silent? ⇒ Boolean
18 19 20 |
# File 'lib/sass/tree/comment_node.rb', line 18 def silent? !!@options[:silent] end |
#to_s(tabs = 0, parent_name = nil) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/sass/tree/comment_node.rb', line 22 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 |