Class Sass::Tree::Node
In: lib/sass/tree/node.rb
Parent: Object

Methods

<<   ==   new   to_s  

Attributes

children  [RW] 
filename  [RW] 
line  [RW] 

Public Class methods

[Source]

    # File lib/sass/tree/node.rb, line 8
 8:       def initialize(style)
 9:         @style = style
10:         @children = []
11:       end

Public Instance methods

[Source]

    # File lib/sass/tree/node.rb, line 13
13:       def <<(child)
14:         if msg = invalid_child?(child)
15:           raise Sass::SyntaxError.new(msg, child.line)
16:         end
17:         @children << child
18:       end

[Source]

    # File lib/sass/tree/node.rb, line 20
20:       def ==(other)
21:         self.class == other.class && other.children == children
22:       end

[Source]

    # File lib/sass/tree/node.rb, line 24
24:       def to_s
25:         result = String.new
26:         children.each do |child|
27:           if child.is_a? AttrNode
28:             raise SyntaxError.new('Attributes aren\'t allowed at the root of a document.', child.line)
29:           else
30:             result << "#{child.to_s(1)}" + (@style == :compressed ? '' : "\n")
31:           end
32:         end
33:         @style == :compressed ? result+"\n" : result[0...-1]
34:       end

[Validate]