class Sass::Tree::Node
The abstract superclass of all parse-tree nodes.
def <<(child)
-
(Sass::SyntaxError)
- if `child` is invalid
Parameters:
-
child
(Tree::Node, Array
) -- The child node or nodes
def <<(child) return if child.nil? if child.is_a?(Array) child.each {|c| self << c} else self.has_children = true @children << child end end
def ==(other)
- See: Sass::Tree -
Returns:
-
(Boolean)
- Whether or not this node and the other object
Parameters:
-
other
(Object
) -- The object to compare with
def ==(other) self.class == other.class && other.children == children end
def balance(*args)
-
(Sass::SyntaxError)
- if the brackets aren't balanced
Other tags:
- See: Sass::Shared.balance -
def balance(*args) res = Sass::Shared.balance(*args) return res if res raise Sass::SyntaxError.new("Unbalanced brackets.", :line => line) end
def children=(children)
- Private: -
def children=(children) self.has_children ||= !children.empty? @children = children end
def deep_copy
-
(Node)
-
def deep_copy Sass::Tree::Visitors::DeepCopy.visit(self) end
def do_extend(extends)
-
(Sass::SyntaxError)
- Only if there's a programmer error
Returns:
-
(Tree::Node)
- The resulting tree of static CSS nodes.
Parameters:
-
extends
(Sass::Util::SubsetMap{Selector::Simple => Selector::Sequence}
) --
Other tags:
- Todo: - Link this to the reference documentation on `@extend`
def do_extend(extends) node = dup node.children = children.map {|c| c.do_extend(extends)} node rescue Sass::SyntaxError => e e.modify_backtrace(:filename => filename, :line => line) raise e end
def each(&block)
- Yieldparam: node - a node in the tree
Other tags:
- Yield: - node
def each(&block) yield self children.each {|c| c.each(&block)} end
def filename
-
(String)
-
def filename @filename || (@options && @options[:filename]) end
def initialize
def initialize @children = [] end
def invisible?; false; end
-
(Boolean)
-
def invisible?; false; end
def options=(options)
- See: #options -
Parameters:
-
options
({Symbol => Object}
) -- The options
def options=(options) Sass::Tree::Visitors::SetOptions.visit(self, options) end
def style
-
(Symbol)
-
def style @options[:style] end
def to_s
- See: Sass::Tree -
Returns:
-
(String, nil)
- The resulting CSS
def to_s Sass::Tree::Visitors::ToCss.visit(self) end
def to_sass(options = {})
-
(String)
- The Sass code corresponding to the node
Parameters:
-
options
({Symbol => Object}
) -- An options hash (see {Sass::CSS#initialize})
def to_sass(options = {}) Sass::Tree::Visitors::Convert.visit(self, options, :sass) end
def to_scss(options = {})
-
(String)
- The Sass code corresponding to the node
Parameters:
-
options
({Symbol => Object}
) -- An options hash (see {Sass::CSS#initialize})
def to_scss(options = {}) Sass::Tree::Visitors::Convert.visit(self, options, :scss) end