haml--haml/lib/sass/tree/node.rb

29 lines
541 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.', @line)
end
result += "#{child.to_s}\n"
end
result[0...-1]
end
end
end
end