### Home Classes Methods

### In Files

- lib/sass/selector/abstract_sequence.rb

### Parent

Object

### Methods

- #==
- #_specificity
- #eql?
- #filename=
- #has_placeholder?
- #hash
- #line=
- #specificity
- #to_s

### 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::Selector::AbstractSequence

The abstract parent class of the various selector sequence classes.

All subclasses should implement a `members` method that returns an array of object that respond to `line=` and `filename=`, as well as a `to_s` method that returns the string representation of the selector.

### Attributes

filename[R]

The name of the file in which this selector was declared.

@return [String, nil]

line[R]

The line of the Sass template on which this selector was declared.

@return [Fixnum]

### Public Instance Methods

==(other) click to toggle source
Alias for: eql?
eql?(other) click to toggle source

Checks equality between this and another object.

Subclasses should define `#_eql?` rather than overriding this method, which handles checking class equality and hash equality.

@param other [Object] The object to test equality against @return [Boolean] Whether or not this is equal to `other`

    # File lib/sass/selector/abstract_sequence.rb, line 57
    def eql?(other)
      other.class == self.class && other.hash == hash && _eql?(other)
    end

Also aliased as: ==
filename=(filename) click to toggle source

Sets the name of the file in which this selector was declared, or `nil` if it was not declared in a file (e.g. on stdin). This also sets the filename for all child selectors.

@param filename [String, nil] @return [String, nil]

    # File lib/sass/selector/abstract_sequence.rb, line 35
    def filename=(filename)
      members.each {|m| m.filename = filename}
      @filename = filename
    end

has_placeholder?() click to toggle source

Whether or not this selector sequence contains a placeholder selector. Checks recursively.

    # File lib/sass/selector/abstract_sequence.rb, line 64
    def has_placeholder?
      @has_placeholder ||= members.any? do |m|
        next m.has_placeholder? if m.is_a?(AbstractSequence)
        next m.selector && m.selector.has_placeholder? if m.is_a?(Pseudo)
        m.is_a?(Placeholder)
      end
    end

hash() click to toggle source

Returns a hash code for this sequence.

Subclasses should define `#_hash` rather than overriding this method, which automatically handles memoizing the result.

@return [Fixnum]

    # File lib/sass/selector/abstract_sequence.rb, line 46
    def hash
      @_hash ||= _hash
    end

line=(line) click to toggle source

Sets the line of the Sass template on which this selector was declared. This also sets the line for all child selectors.

@param line [Fixnum] @return [Fixnum]

    # File lib/sass/selector/abstract_sequence.rb, line 24
    def line=(line)
      members.each {|m| m.line = line}
      @line = line
    end

specificity() click to toggle source

Returns the specificity of the selector.

The base is given by {Sass::Selector::SPECIFICITY_BASE}. This can be a number or a range representing possible specificities.

@return [Fixnum, Range]

    # File lib/sass/selector/abstract_sequence.rb, line 85
    def specificity
      _specificity(members)
    end

to_s() click to toggle source

Returns the selector string.

@return [String]

    # File lib/sass/selector/abstract_sequence.rb, line 75
    def to_s
      Sass::Util.abstract(self)
    end

### Protected Instance Methods

_specificity(arr) click to toggle source

    # File lib/sass/selector/abstract_sequence.rb, line 91
    def _specificity(arr)
      min = 0
      max = 0
      arr.each do |m|
        next if m.is_a?(String)
        spec = m.specificity
        if spec.is_a?(Range)
          min += spec.begin
          max += spec.end
        else
          min += spec
          max += spec
        end
      end
      min == max ? min : (min..max)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.