A static node that is the root node of the Sass document.
@param template [String] The Sass template from which this node was created
# File lib/sass/tree/root_node.rb, line 11 11: def initialize(template) 12: super() 13: @template = template 14: end
Like {Node#cssize}, except that this method will create its own `extends` map if necessary, and it returns that map along with the cssized tree.
@return [(Tree::Node, Haml::Util::SubsetMap)] The resulting tree of static nodes
*and* the extensions defined for this tree
# File lib/sass/tree/root_node.rb, line 49 49: def cssize(extends = Haml::Util::SubsetMap.new, parent = nil) 50: return super(extends), extends 51: rescue Sass::SyntaxError => e 52: e.sass_template = @template 53: raise e 54: end
@see Node#perform
# File lib/sass/tree/root_node.rb, line 35 35: def perform(environment) 36: environment.options = @options if environment.options.nil? || environment.options.empty? 37: super 38: rescue Sass::SyntaxError => e 39: e.sass_template = @template 40: raise e 41: end
@see {Node#perform!}
# File lib/sass/tree/root_node.rb, line 57 57: def perform!(environment) 58: environment.options = @options if environment.options.nil? || environment.options.empty? 59: super 60: end
@see Node#to_s
# File lib/sass/tree/root_node.rb, line 17 17: def to_s(*args) 18: super 19: rescue Sass::SyntaxError => e 20: e.sass_template = @template 21: raise e 22: end
Computes the CSS corresponding to this Sass tree.
@param args [Array] ignored @return [String] The resulting CSS @see Sass::Tree
# File lib/sass/tree/root_node.rb, line 100 100: def _to_s(*args) 101: result = String.new 102: children.each do |child| 103: next if child.invisible? 104: child_str = child.to_s(1) 105: result << child_str + (style == :compressed ? '' : "\n") 106: end 107: result.rstrip! 108: return "" if result.empty? 109: return result + "\n" 110: end
Returns an error message if the given child node is invalid, and false otherwise.
Only property nodes are invalid at root level.
@see Node#invalid_child?
# File lib/sass/tree/root_node.rb, line 118 118: def invalid_child?(child) 119: return unless child.is_a?(Tree::PropNode) 120: "Properties aren't allowed at the root of a document." + 121: child.pseudo_class_selector_message 122: end
@see Node#to_src
# File lib/sass/tree/root_node.rb, line 81 81: def to_src(opts, fmt) 82: Haml::Util.enum_cons(children + [nil], 2).map do |child, nxt| 83: child.send("to_#{fmt}", 0, opts) + 84: if nxt && 85: (child.is_a?(CommentNode) && child.line + child.value.count("\n") + 1 == nxt.line) || 86: (child.is_a?(ImportNode) && nxt.is_a?(ImportNode) && child.line + 1 == nxt.line) || 87: (child.is_a?(VariableNode) && nxt.is_a?(VariableNode) && child.line + 1 == nxt.line) 88: "" 89: else 90: "\n" 91: end 92: end.join.rstrip + "\n" 93: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.