Class: Sass::Selector::Attribute
Overview
An attribute selector (e.g. [href^="http://"]
).
Instance Attribute Summary collapse
-
#flags ⇒ Array<String, Sass::Script::Node>
readonly
Flags for the attribute selector (e.g.
i
). -
#name ⇒ Array<String, Sass::Script::Node>
readonly
The attribute name.
-
#namespace ⇒ Array<String, Sass::Script::Node>?
readonly
The attribute namespace.
-
#operator ⇒ String
readonly
The matching operator, e.g.
-
#value ⇒ Array<String, Sass::Script::Node>
readonly
The right-hand side of the operator.
Attributes inherited from Simple
Instance Method Summary collapse
-
#initialize(name, namespace, operator, value, flags) ⇒ Attribute
constructor
A new instance of Attribute.
- #specificity
- #to_a
Methods inherited from Simple
#eql?, #hash, #inspect, #to_s, #unify, #unify_namespaces
Constructor Details
#initialize(name, namespace, operator, value, flags) ⇒ Attribute
Returns a new instance of Attribute.
322 323 324 325 326 327 328 |
# File 'lib/sass/selector.rb', line 322
def initialize(name, namespace, operator, value, flags)
@name = name
@namespace = namespace
@operator = operator
@value = value
@flags = flags
end
|
Instance Attribute Details
#flags ⇒ Array<String, Sass::Script::Node> (readonly)
Flags for the attribute selector (e.g. i
).
315 316 317 |
# File 'lib/sass/selector.rb', line 315
def flags
@flags
end
|
#name ⇒ Array<String, Sass::Script::Node> (readonly)
The attribute name.
292 293 294 |
# File 'lib/sass/selector.rb', line 292
def name
@name
end
|
#namespace ⇒ Array<String, Sass::Script::Node>? (readonly)
The attribute namespace.
nil
means the default namespace,
[""]
means no namespace,
["*"]
means any namespace.
300 301 302 |
# File 'lib/sass/selector.rb', line 300
def namespace
@namespace
end
|
#operator ⇒ String (readonly)
The matching operator, e.g. "="
or "^="
.
305 306 307 |
# File 'lib/sass/selector.rb', line 305
def operator
@operator
end
|
#value ⇒ Array<String, Sass::Script::Node> (readonly)
The right-hand side of the operator.
310 311 312 |
# File 'lib/sass/selector.rb', line 310
def value
@value
end
|
Instance Method Details
#specificity
341 342 343 |
# File 'lib/sass/selector.rb', line 341
def specificity
SPECIFICITY_BASE
end
|
#to_a
331 332 333 334 335 336 337 338 |
# File 'lib/sass/selector.rb', line 331
def to_a
res = ["["]
res.concat(@namespace) << "|" if @namespace
res.concat @name
(res << @operator).concat @value if @value
(res << " ").concat @flags if @flags
res << "]"
end
|