Class | Sass::Tree::Node |
In: |
lib/sass/tree/node.rb
|
Parent: | Object |
children | [RW] | |
filename | [RW] | |
line | [RW] |
# File lib/sass/tree/node.rb, line 8 8: def initialize(style) 9: @style = style 10: @children = [] 11: end
# 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
# 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