Class: Sass::Selector::Attribute

Inherits:
Simple
  • Object
show all
Defined in:
lib/sass/selector.rb

Overview

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

Instance Attribute Summary collapse

Attributes inherited from Simple

#filename, #line

Instance Method Summary collapse

Methods inherited from Simple

#eql?, #equality_key, #hash, #inspect, #unify, #unify_namespaces, #unique?

Constructor Details

#initialize(name, namespace, operator, value, flags) ⇒ Attribute



305
306
307
308
309
310
311
312
# File 'lib/sass/selector.rb', line 305

def initialize(name, namespace, operator, value, flags)
  # rubocop:enable ParameterLists
  @name = name
  @namespace = namespace
  @operator = operator
  @value = value
  @flags = flags
end

Instance Attribute Details

#flagsString (readonly)

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



296
297
298
# File 'lib/sass/selector.rb', line 296

def flags
  @flags
end

#nameArray<String, Sass::Script::Tree::Node> (readonly)

The attribute name.



275
276
277
# File 'lib/sass/selector.rb', line 275

def name
  @name
end

#namespaceString? (readonly)

The attribute namespace. nil means the default namespace, "" means no namespace, "*" means any namespace.



281
282
283
# File 'lib/sass/selector.rb', line 281

def namespace
  @namespace
end

#operatorString (readonly)

The matching operator, e.g. "=" or "^=".



286
287
288
# File 'lib/sass/selector.rb', line 286

def operator
  @operator
end

#valueString (readonly)

The right-hand side of the operator.



291
292
293
# File 'lib/sass/selector.rb', line 291

def value
  @value
end

Instance Method Details

#specificity



325
326
327
# File 'lib/sass/selector.rb', line 325

def specificity
  SPECIFICITY_BASE
end

#to_s

See Also:

  • Selector#to_s


315
316
317
318
319
320
321
322
# File 'lib/sass/selector.rb', line 315

def to_s
  res = "["
  res << @namespace << "|" if @namespace
  res << @name
  res << @operator << @value if @value
  res << " " << @flags if @flags
  res << "]"
end