### Home Classes Methods

### In Files

- lib/sass/tree/rule_node.rb

### Parent

Sass::Tree::Node

### Methods

- ::new
- #==
- #add_rules
- #continued?
- #debug_info
- #filename=
- #invisible?
- #line=

### Class/Module Index

Quicksearch

- Sass
- Sass::BaseEnvironment
- Sass::CSS
- Sass::CacheStores
- Sass::CacheStores::Base
- Sass::CacheStores::Chain
- Sass::CacheStores::Filesystem
- Sass::CacheStores::Memory
- Sass::CacheStores::Null
- Sass::Callbacks
- Sass::Callbacks::InstanceMethods
- Sass::Engine
- Sass::Engine::Line
- Sass::Environment
- Sass::Exec
- Sass::Exec::Base
- Sass::Exec::SassConvert
- Sass::Exec::SassScss
- Sass::Exec::SassScss::Sass::Plugin.compiler
- Sass::Features
- Sass::Importers
- Sass::Importers::Base
- Sass::Importers::Filesystem
- Sass::Logger
- Sass::Logger::Base
- Sass::Logger::LogLevel
- Sass::Logger::LogLevel::ClassMethods
- Sass::Media
- Sass::Media::Query
- Sass::Media::QueryList
- Sass::Plugin
- Sass::Plugin::Compiler
- Sass::Plugin::Configuration
- Sass::Plugin::MerbBootLoader
- Sass::Plugin::Rack
- Sass::Plugin::StalenessChecker
- Sass::ReadOnlyEnvironment
- Sass::Repl
- Sass::SCSS
- Sass::SCSS::CssParser
- Sass::SCSS::Parser
- Sass::SCSS::RX
- Sass::SCSS::ScriptLexer
- Sass::SCSS::ScriptParser
- Sass::SCSS::StaticParser
- Sass::Script
- Sass::Script::CssLexer
- Sass::Script::CssParser
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::Lexer
- Sass::Script::Parser
- Sass::Script::Tree
- Sass::Script::Tree::Funcall
- Sass::Script::Tree::Interpolation
- Sass::Script::Tree::ListLiteral
- Sass::Script::Tree::Literal
- Sass::Script::Tree::MapLiteral
- Sass::Script::Tree::Node
- Sass::Script::Tree::Operation
- Sass::Script::Tree::Selector
- Sass::Script::Tree::StringInterpolation
- Sass::Script::Tree::UnaryOperation
- Sass::Script::Tree::Variable
- Sass::Script::Value
- Sass::Script::Value::ArgList
- Sass::Script::Value::Base
- Sass::Script::Value::Bool
- Sass::Script::Value::Color
- Sass::Script::Value::Helpers
- Sass::Script::Value::List
- Sass::Script::Value::Map
- Sass::Script::Value::Null
- Sass::Script::Value::Number
- Sass::Script::Value::String
- Sass::Selector
- Sass::Selector::AbstractSequence
- Sass::Selector::Attribute
- Sass::Selector::Class
- Sass::Selector::CommaSequence
- Sass::Selector::Element
- Sass::Selector::Id
- Sass::Selector::Parent
- Sass::Selector::Placeholder
- Sass::Selector::Pseudo
- Sass::Selector::Sequence
- Sass::Selector::Simple
- Sass::Selector::SimpleSequence
- Sass::Selector::Universal
- Sass::SemiGlobalEnvironment
- Sass::Shared
- Sass::Source
- Sass::Source::Map
- Sass::Source::Map::Mapping
- Sass::Source::Position
- Sass::Source::Range
- Sass::Stack
- Sass::Stack::Frame
- Sass::Supports
- Sass::Supports::Condition
- Sass::Supports::Declaration
- Sass::Supports::Interpolation
- Sass::Supports::Negation
- Sass::Supports::Operator
- Sass::SyntaxError
- Sass::Tree
- Sass::Tree::AtRootNode
- Sass::Tree::CharsetNode
- Sass::Tree::CommentNode
- Sass::Tree::ContentNode
- Sass::Tree::CssImportNode
- Sass::Tree::DebugNode
- Sass::Tree::DirectiveNode
- Sass::Tree::EachNode
- Sass::Tree::ErrorNode
- Sass::Tree::ExtendNode
- Sass::Tree::ForNode
- Sass::Tree::FunctionNode
- Sass::Tree::IfNode
- Sass::Tree::ImportNode
- Sass::Tree::KeyframeRuleNode
- Sass::Tree::MediaNode
- Sass::Tree::MixinDefNode
- Sass::Tree::MixinNode
- Sass::Tree::Node
- Sass::Tree::PropNode
- Sass::Tree::ReturnNode
- Sass::Tree::RootNode
- Sass::Tree::RuleNode
- Sass::Tree::SupportsNode
- Sass::Tree::TraceNode
- Sass::Tree::VariableNode
- Sass::Tree::Visitors
- Sass::Tree::Visitors::Base
- Sass::Tree::Visitors::CheckNesting
- Sass::Tree::Visitors::Convert
- Sass::Tree::Visitors::Cssize
- Sass::Tree::Visitors::Cssize::Bubble
- Sass::Tree::Visitors::DeepCopy
- Sass::Tree::Visitors::Extend
- Sass::Tree::Visitors::Perform
- Sass::Tree::Visitors::SetOptions
- Sass::Tree::Visitors::ToCss
- Sass::Tree::WarnNode
- Sass::Tree::WhileNode
- Sass::UnitConversionError
- Sass::Util
- Sass::Util::CrossPlatformRandom
- Sass::Util::MultibyteStringScanner
- Sass::Util::NormalizedMap
- Sass::Util::StaticConditionalContext
- Sass::Util::SubsetMap
- Sass::Util::Test
- Sass::Version
- ActionController
- ActionController::Base
- Object
- OrderedHash

No matching classes.

# Sass::Tree::RuleNode

A static node representing a CSS rule.

@see Sass::Tree

### 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 guaranteed to be set once {Tree::Visitors::Perform} has been run, but it may be set before then for optimization reasons.

@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::Visitors::Perform} has been run.

@return [Selector::CommaSequence]

rule[RW]

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

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

selector_source_range[RW]

The entire selector source range for this rule. @return [Sass::Source::Range]

stack_trace[RW]

The stack trace. This is only readable in a CSS tree as it is written during the perform step and only when the :trace_selectors option is set.

@return [String]

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

new(rule, selector_source_range = nil) click to toggle source

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

    The CSS rule, either unparsed or parsed.

@param selector_source_range [Sass::Source::Range]

    # File lib/sass/tree/rule_node.rb, line 66
    def initialize(rule, selector_source_range = nil)
      if rule.is_a?(Sass::Selector::CommaSequence)
        @rule = [rule.to_s]
        @parsed_rules = rule
      else
        merged = Sass::Util.merge_adjacent_strings(rule)
        @rule = Sass::Util.strip_string_array(merged)
        try_to_parse_non_interpolated_rules
      end
      @selector_source_range = selector_source_range
      @tabs = 0
      super()
    end

### Public Instance Methods

==(other) click to toggle source

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

    # File lib/sass/tree/rule_node.rb, line 97
    def ==(other)
      self.class == other.class && rule == other.rule && super
    end

add_rules(node) click to toggle source

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

@param node [RuleNode] The other node

    # File lib/sass/tree/rule_node.rb, line 104
    def add_rules(node)
      @rule = Sass::Util.strip_string_array(
        Sass::Util.merge_adjacent_strings(@rule + ["\n"] + node.rule))
      try_to_parse_non_interpolated_rules
    end

continued?() click to toggle source

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

    # File lib/sass/tree/rule_node.rb, line 111
    def continued?
      last = @rule.last
      last.is_a?(String) && last[-1] == ,,
    end

debug_info() click to toggle source

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}]

    # File lib/sass/tree/rule_node.rb, line 122
    def debug_info
      {:filename => filename && ("file://" + Sass::Util.escape_uri(File.expand_path(filename))),
       :line => line}
    end

filename=(filename) click to toggle source

If we’ve precached the parsed selector, set the filename on it, too.

    # File lib/sass/tree/rule_node.rb, line 87
    def filename=(filename)
      @parsed_rules.filename = filename if @parsed_rules
      super
    end

invisible?() click to toggle source

A rule node is invisible if it has only placeholder selectors.

    # File lib/sass/tree/rule_node.rb, line 128
    def invisible?
      resolved_rules.members.all? {|seq| seq.has_placeholder?}
    end

line=(line) click to toggle source

If we’ve precached the parsed selector, set the line on it, too.

    # File lib/sass/tree/rule_node.rb, line 81
    def line=(line)
      @parsed_rules.line = line if @parsed_rules
      super
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.