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.
- #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, #unify_namespaces
Constructor Details
#initialize(name) ⇒ Id
Returns a new instance of Id.
65 66 67 |
# File 'lib/sass/selector.rb', line 65
def initialize(name)
@name = name
end
|
Instance Attribute Details
#name ⇒ Array<String, Sass::Script::Node> (readonly)
The id name.
62 63 64 |
# File 'lib/sass/selector.rb', line 62
def name
@name
end
|
Instance Method Details
#to_a
70 71 72 |
# File 'lib/sass/selector.rb', line 70
def to_a
["#", *@name]
end
|
#unify(sels)
Returns nil
if sels
contains an Sass::Selector::Id selector
with a different name than this one.
78 79 80 81 |
# File 'lib/sass/selector.rb', line 78
def unify(sels)
return if sels.any? {|sel2| sel2.is_a?(Id) && self.name != sel2.name}
super
end
|