Class: Sass::Selector::Id
- Inherits:
- Simple
- Object
- Simple
- Sass::Selector::Id
- Defined in:
- /Users/ceppstei/Projects/sass-lang/.sass/lib/sass/selector.rb
Overview
An id selector (e.g. #foo
).
Instance Attribute Summary (collapse)
- - (String) name readonly
The id name.
Attributes inherited from Simple
Instance Method Summary (collapse)
- - (Id) initialize(name) constructor
A new instance of Id.
- - specificity
- - to_s(opts = {})
- - unify(sels)
Returns
nil
ifsels
contains an Id selector with a different name than this one.
Methods inherited from Simple
#eql?, #equality_key, #hash, #inspect, #unify_namespaces
Constructor Details
- (Id) initialize(name)
Returns a new instance of Id
86 87 88 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/selector.rb', line 86
def initialize(name)
@name = name
end |
Instance Attribute Details
- (String) name (readonly)
The id name.
83 84 85 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/selector.rb', line 83
def name
@name
end |
Instance Method Details
- specificity
105 106 107 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/selector.rb', line 105
def specificity
SPECIFICITY_BASE**2
end |
- to_s(opts = {})
91 92 93 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/selector.rb', line 91
def to_s(opts = {})
"#" + @name
end |
- unify(sels)
Returns nil
if sels
contains an Sass::Selector::Id selector with a different name than this one.
99 100 101 102 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/selector.rb', line 99
def unify(sels)
return if sels.any? {|sel2| sel2.is_a?(Id) && name != sel2.name}
super
end |