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

Methods

<<   check_multiline_rule   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 to_s
21:         result = String.new
22:         children.each do |child|
23:           if child.is_a? AttrNode
24:             raise SyntaxError.new('Attributes aren\'t allowed at the root of a document.', child.line)
25:           elsif child.is_a?(RuleNode) && child.continued?
26:             check_multiline_rule(child)
27:             result << child.to_s(1)
28:           else
29:             result << "#{child.to_s(1)}" + (@style == :compressed ? '' : "\n")
30:           end
31:         end
32:         @style == :compressed ? result+"\n" : result[0...-1]
33:       end

Protected Instance methods

[Source]

    # File lib/sass/tree/node.rb, line 37
37:       def check_multiline_rule(rule)
38:         unless rule.children.empty?
39:           raise SyntaxError.new('Rules can\'t end in commas.', rule.line)
40:         end
41:       end

[Validate]