Class: Sass::Selector::Attribute
Overview
An attribute selector (e.g. [href^="http://"]
).
Instance Attribute Summary collapse
-
#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) ⇒ Attribute
constructor
A new instance of Attribute.
- #to_a
Methods inherited from Simple
#eql?, #hash, #inspect, #unify, #unify_namespaces
Constructor Details
#initialize(name, namespace, operator, value) ⇒ Attribute
Returns a new instance of Attribute.
263 264 265 266 267 268 |
# File 'lib/sass/selector.rb', line 263
def initialize(name, namespace, operator, value)
@name = name
@namespace = namespace
@operator = operator
@value = value
end
|
Instance Attribute Details
#name ⇒ Array<String, Sass::Script::Node> (readonly)
The attribute name.
239 240 241 |
# File 'lib/sass/selector.rb', line 239
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.
247 248 249 |
# File 'lib/sass/selector.rb', line 247
def namespace
@namespace
end
|
#operator ⇒ String (readonly)
The matching operator, e.g. "="
or "^="
.
252 253 254 |
# File 'lib/sass/selector.rb', line 252
def operator
@operator
end
|
#value ⇒ Array<String, Sass::Script::Node> (readonly)
The right-hand side of the operator.
257 258 259 |
# File 'lib/sass/selector.rb', line 257
def value
@value
end
|
Instance Method Details
#to_a
271 272 273 274 275 276 277 |
# File 'lib/sass/selector.rb', line 271
def to_a
res = ["["]
res.concat(@namespace) << "|" if @namespace
res.concat @name
(res << @operator).concat @value if @value
res << "]"
end
|