class Sass::Selector::Attribute - sass-3.4.14 Documentation

# class Sass::Selector::Attribute

An attribute selector (e.g. `[href^=“http://”]`).

### Attributes

flags[R]

Flags for the attribute selector (e.g. `i`).

@return [String]

name[R]

The attribute name.

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

namespace[R]

The attribute namespace. `nil` means the default namespace, `“”` means no namespace, `“*”` means any namespace.

@return [String, nil]

operator[R]

The matching operator, e.g. `“=”` or `“^=”`.

@return [String]

value[R]

The right-hand side of the operator.

@return [String]

### Public Class Methods

new(name, namespace, operator, value, flags) click to toggle source

@param name [String] The attribute name @param namespace [String, nil] See {#namespace} @param operator [String] The matching operator, e.g. `“=”` or `“^=”` @param value [String] See {#value} @param flags [String] See {#flags} @comment

    rubocop:disable ParameterLists

    # File lib/sass/selector.rb, line 301
    def initialize(name, namespace, operator, value, flags)
      # rubocop:enable ParameterLists
      @name = name
      @namespace = namespace
      @operator = operator
      @value = value
      @flags = flags
    end

### Public Instance Methods

specificity() click to toggle source

@see Sass::Selector::AbstractSequence#specificity

    # File lib/sass/selector.rb, line 321
    def specificity
      SPECIFICITY_BASE
    end

to_s() click to toggle source

@see Selector#to_s

    # File lib/sass/selector.rb, line 311
    def to_s
      res = "["
      res << @namespace << "|" if @namespace
      res << @name
      res << @operator << @value if @value
      res << " " << @flags if @flags
      res << "]"
    end