mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
28 lines
546 B
Ruby
28 lines
546 B
Ruby
module Sass
|
|
module Tree
|
|
class Node
|
|
attr_accessor :children
|
|
attr_accessor :line
|
|
|
|
def initialize
|
|
@children = []
|
|
end
|
|
|
|
def <<(child)
|
|
@children << child
|
|
end
|
|
|
|
def to_s
|
|
result = String.new
|
|
children.each do |child|
|
|
if child.is_a? AttrNode
|
|
raise SyntaxError.new('Attributes aren\'t allowed at the root of a document.', child.line)
|
|
end
|
|
|
|
result += "#{child.to_s}\n"
|
|
end
|
|
result[0...-1]
|
|
end
|
|
end
|
|
end
|
|
end
|