Class Sass::Tree::Node
In: lib/sass/tree/node.rb
Parent: Object

The abstract superclass of all parse-tree nodes.

Methods

Included Modules

Enumerable

Attributes

children  [RW]  The child nodes of this node.

@return [Array<Tree::Node>]

filename  [W]  The name of the document on which this node appeared.

@return [String]

has_children  [RW]  Whether or not this node has child nodes. This may be true even when \{children} is empty, in which case this node has an empty block (e.g. `{}`).

@return [Boolean]

line  [RW]  The line of the document on which this node appeared.

@return [Fixnum]

options  [R]  The options hash for the node. See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.

@return [{Symbol => Object}]

Public Class methods

Public Instance methods

Appends a child to the node.

@param child [Tree::Node, Array<Tree::Node>] The child node or nodes @raise [Sass::SyntaxError] if `child` is invalid

Compares this node and another object (only other {Tree::Node}s will be equal). This does a structural comparison; if the contents of the nodes and all the child nodes are equivalent, then the nodes are as well.

Only static nodes need to override this.

@param other [Object] The object to compare with @return [Boolean] Whether or not this node and the other object

  are the same

@see Sass::Tree

Return a deep clone of this node. The child nodes are cloned, but options are not.

@return [Node]

Converts a static CSS tree (e.g. the output of \{Tree::Visitors::Cssize}) into another static CSS tree, with the given extensions applied to all relevant {RuleNode}s.

@todo Link this to the reference documentation on `@extend`

  when such a thing exists.

@param extends [Sass::Util::SubsetMap{Selector::Simple => Selector::Sequence}]

  The extensions to perform on this tree

@return [Tree::Node] The resulting tree of static CSS nodes. @raise [Sass::SyntaxError] Only if there‘s a programmer error

  and this is not a static CSS tree

Iterates through each node in the tree rooted at this node in a pre-order walk.

@yield node @yieldparam node [Node] a node in the tree

The name of the document on which this node appeared.

@return [String]

True if \{to_s} will return `nil`; that is, if the node shouldn‘t be rendered. Should only be called in a static tree.

@return [Boolean]

Sets the options hash for the node and all its children.

@param options [{Symbol => Object}] The options @see options

The output style. See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.

@return [Symbol]

Computes the CSS corresponding to this static CSS tree.

@return [String, nil] The resulting CSS @see Sass::Tree

Converts a node to Sass code that will generate it.

@param options [{Symbol => Object}] An options hash (see {Sass::CSS#initialize}) @return [String] The Sass code corresponding to the node

Converts a node to SCSS code that will generate it.

@param options [{Symbol => Object}] An options hash (see {Sass::CSS#initialize}) @return [String] The Sass code corresponding to the node

Protected Instance methods

@see Sass::Shared.balance @raise [Sass::SyntaxError] if the brackets aren‘t balanced

[Validate]