Class: Sass::Selector::Attribute
Overview
An attribute selector (e.g. [href^="http://"]
).
Instance Attribute Summary collapse
-
#flags ⇒ String
readonly
Flags for the attribute selector (e.g.
i
). -
#name ⇒ Array<String, Sass::Script::Tree::Node>
readonly
The attribute name.
-
#namespace ⇒ String?
readonly
The attribute namespace.
-
#operator ⇒ String
readonly
The matching operator, e.g.
-
#value ⇒ String
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_s
Methods inherited from Simple
#eql?, #equality_key, #hash, #inspect, #unify, #unify_namespaces
Constructor Details
#initialize(name, namespace, operator, value, flags) ⇒ Attribute
Returns a new instance of Attribute.
301 302 303 304 305 306 307 308 |
# 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
|
Instance Attribute Details
#flags ⇒ String (readonly)
Flags for the attribute selector (e.g. i
).
292 293 294 |
# File 'lib/sass/selector.rb', line 292
def flags
@flags
end
|
#name ⇒ Array<String, Sass::Script::Tree::Node> (readonly)
The attribute name.
271 272 273 |
# File 'lib/sass/selector.rb', line 271
def name
@name
end
|
#namespace ⇒ String? (readonly)
The attribute namespace. nil
means the default namespace, ""
means
no namespace, "*"
means any namespace.
277 278 279 |
# File 'lib/sass/selector.rb', line 277
def namespace
@namespace
end
|
#operator ⇒ String (readonly)
The matching operator, e.g. "="
or "^="
.
282 283 284 |
# File 'lib/sass/selector.rb', line 282
def operator
@operator
end
|
#value ⇒ String (readonly)
The right-hand side of the operator.
287 288 289 |
# File 'lib/sass/selector.rb', line 287
def value
@value
end
|
Instance Method Details
#specificity
321 322 323 |
# File 'lib/sass/selector.rb', line 321
def specificity
SPECIFICITY_BASE
end
|
#to_s
311 312 313 314 315 316 317 318 |
# 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
|