Sha256: 0a39b9b024acd41da9d78670b73b19e5728612a38244272e0f1b7aba542bd5fa
Contents?: true
Size: 1.01 KB
Versions: 18
Compression:
Stored size: 1.01 KB
Contents
module Sass module Tree class Node attr_accessor :children attr_accessor :line attr_accessor :filename def initialize(style) @style = style @children = [] end def <<(child) if msg = invalid_child?(child) raise Sass::SyntaxError.new(msg, child.line) end @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) else result << "#{child.to_s(1)}" + (@style == :compressed ? '' : "\n") end end @style == :compressed ? result+"\n" : result[0...-1] end private # This method should be overridden by subclasses to return an error message # if the given child node is invalid, # and false or nil otherwise. def invalid_child?(child) false end end end end
Version data entries
18 entries across 18 versions & 3 rubygems