Class: Sass::Selector::Id
Overview
An id selector (e.g. #foo
).
Instance Attribute Summary collapse
-
#name ⇒ Array<String, Sass::Script::Node>
readonly
The id name.
Attributes inherited from Simple
Instance Method Summary collapse
-
#initialize(name) ⇒ Id
constructor
A new instance of Id.
- #specificity
- #to_a
-
#unify(sels)
Returns
nil
ifsels
contains an Id selector with a different name than this one.
Methods inherited from Simple
#eql?, #hash, #inspect, #to_s, #unify_namespaces
Constructor Details
#initialize(name) ⇒ Id
Returns a new instance of Id.
77 78 79 |
# File 'lib/sass/selector.rb', line 77
def initialize(name)
@name = name
end
|
Instance Attribute Details
#name ⇒ Array<String, Sass::Script::Node> (readonly)
The id name.
74 75 76 |
# File 'lib/sass/selector.rb', line 74
def name
@name
end
|
Instance Method Details
#specificity
96 97 98 |
# File 'lib/sass/selector.rb', line 96
def specificity
SPECIFICITY_BASE**2
end
|
#to_a
82 83 84 |
# File 'lib/sass/selector.rb', line 82
def to_a
["#", *@name]
end
|
#unify(sels)
Returns nil
if sels
contains an Sass::Selector::Id selector
with a different name than this one.
90 91 92 93 |
# File 'lib/sass/selector.rb', line 90
def unify(sels)
return if sels.any? {|sel2| sel2.is_a?(Id) && self.name != sel2.name}
super
end
|