Class: Sass::Selector::Attribute

Inherits:
Simple
  • Object
show all
Defined in:
/home/nweiz/code/sass-site/.sass/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

- (Attribute) initialize(name, namespace, operator, value, flags)

Returns a new instance of Attribute

Parameters:

  • name (String)

    The attribute name

  • namespace (String, nil)
  • operator (String)

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

  • value (String)

    See #value

  • flags (String)

    See #flags



303
304
305
306
307
308
309
# File '/home/nweiz/code/sass-site/.sass/lib/sass/selector.rb', line 303

def initialize(name, namespace, operator, value, flags)
  @name = name
  @namespace = namespace
  @operator = operator
  @value = value
  @flags = flags
end

Instance Attribute Details

- (String) flags (readonly)

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

Returns:

  • (String)


296
297
298
# File '/home/nweiz/code/sass-site/.sass/lib/sass/selector.rb', line 296

def flags
  @flags
end

- (Array<String, Sass::Script::Tree::Node>) name (readonly)

The attribute name.

Returns:



275
276
277
# File '/home/nweiz/code/sass-site/.sass/lib/sass/selector.rb', line 275

def name
  @name
end

- (String?) namespace (readonly)

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

Returns:

  • (String, nil)


281
282
283
# File '/home/nweiz/code/sass-site/.sass/lib/sass/selector.rb', line 281

def namespace
  @namespace
end

- (String) operator (readonly)

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

Returns:

  • (String)


286
287
288
# File '/home/nweiz/code/sass-site/.sass/lib/sass/selector.rb', line 286

def operator
  @operator
end

- (String) value (readonly)

The right-hand side of the operator.

Returns:

  • (String)


291
292
293
# File '/home/nweiz/code/sass-site/.sass/lib/sass/selector.rb', line 291

def value
  @value
end

Instance Method Details

- specificity



322
323
324
# File '/home/nweiz/code/sass-site/.sass/lib/sass/selector.rb', line 322

def specificity
  SPECIFICITY_BASE
end

- to_s(opts = {})

See Also:

  • Selector#to_s


312
313
314
315
316
317
318
319
# File '/home/nweiz/code/sass-site/.sass/lib/sass/selector.rb', line 312

def to_s(opts = {})
  res = "["
  res << @namespace << "|" if @namespace
  res << @name
  res << @operator << @value if @value
  res << " " << @flags if @flags
  res << "]"
end