Class Sass::Tree::RuleNode
In: lib/sass/tree/rule_node.rb
Parent: Node

A static node reprenting a CSS rule.

@see Sass::Tree

Methods

==   _cssize   _to_s   add_rules   continued?   cssize!   debug_info   do_extend   new   perform!   to_sass   to_scss  

Constants

PARENT = '&'   The character used to include the parent selector

Attributes

group_end  [RW]  Whether or not this rule is the last rule in a nested group. This is only set in a CSS tree.

@return [Boolean]

parsed_rules  [RW]  The CSS selector for this rule, without any unresolved interpolation but with parent references still intact. It‘s only set once {Tree::Node#perform} has been called.

@return [Selector::CommaSequence]

resolved_rules  [RW]  The CSS selector for this rule, without any unresolved interpolation or parent references. It‘s only set once {Tree::Node#cssize} has been called.

@return [Selector::CommaSequence]

rule  [RW]  The CSS selector for this rule, interspersed with {Sass::Script::Node}s representing `#{}`-interpolation. Any adjacent strings will be merged together.

@return [Array<String, Sass::Script::Node>]

tabs  [RW]  How deep this rule is indented relative to a base-level rule. This is only greater than 0 in the case that:
  • This node is in a CSS tree
  • The style is :nested
  • This is a child rule of another rule
  • The parent rule has properties, and thus will be rendered

@return [Fixnum]

Public Class methods

@param rule [Array<String, Sass::Script::Node>]

  The CSS rule. See \{#rule}

Public Instance methods

Compares the contents of two rules.

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

  are the same

Adds another {RuleNode}’s rules to this one‘s.

@param node [RuleNode] The other node

@return [Boolean] Whether or not this rule is continued on the next line

Extends this Rule‘s selector with the given `extends`.

@see Node#do_extend

Protected Instance methods

Converts nested rules into a flat list of rules.

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

  The extensions defined for this tree

@param parent [RuleNode, nil] The parent node of this node,

  or nil if the parent isn't a {RuleNode}

Computes the CSS for the rule.

@param tabs [Fixnum] The level of indentation for the CSS @return [String] The resulting CSS

Resolves parent references and nested selectors, and updates the indentation based on the parent‘s indentation.

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

  The extensions defined for this tree

@param parent [RuleNode, nil] The parent node of this node,

  or nil if the parent isn't a {RuleNode}

@raise [Sass::SyntaxError] if the rule has no parents but uses `&`

A hash that will be associated with this rule in the CSS document if the {file:SASS_REFERENCE.md#debug_info-option `:debug_info` option} is enabled. This data is used by e.g. [the FireSass Firebug extension](addons.mozilla.org/en-US/firefox/addon/103988).

@return [{to_s => to_s}]

Runs SassScript interpolation in the selector, and then parses the result into a {Sass::Selector::CommaSequence}.

@param environment [Sass::Environment] The lexical environment containing

  variable and mixin values

[Validate]