A visitor for performing selector inheritance on a static CSS tree.
Destructively modifies the tree.
# File lib/sass/tree/visitors/extend.rb, line 21 def initialize(extends) @parent_directives = [] @extends = extends end
Performs the given extensions on the static CSS tree based in `root`, then validates that all extends matched some selector.
@param root [Tree::Node] The root node of the tree to visit. @param extends [Sass::Util::SubsetMap{Selector::Simple =>
Sass::Tree::Visitors::Cssize::Extend}] The extensions to perform on this tree.
@return [Object] The return value of {#visit} for the root node.
# File lib/sass/tree/visitors/extend.rb, line 13 def self.visit(root, extends) return if extends.empty? new(extends).send(:visit, root) check_extends_fired! extends end
If an exception is raised, this adds proper metadata to the backtrace.
# File lib/sass/tree/visitors/extend.rb, line 27 def visit(node) super(node) rescue Sass::SyntaxError => e e.modify_backtrace(:filename => node.filename, :line => node.line) raise e end
Keeps track of the current parent directives.
# File lib/sass/tree/visitors/extend.rb, line 35 def visit_children(parent) @parent_directives.push parent if parent.is_a?(Sass::Tree::DirectiveNode) super ensure @parent_directives.pop if parent.is_a?(Sass::Tree::DirectiveNode) end
Generated with the Darkfish Rdoc Generator 2.