Class: Sass::Selector::Id
- Inherits:
-
Simple
- Object
- Simple
- Sass::Selector::Id
- Defined in:
- .ruby-sass/lib/sass/selector.rb
Overview
An id selector (e.g. `#foo`).
Instance Attribute Summary (collapse)
-
#name ⇒ String
readonly
The id name.
Attributes inherited from Simple
Instance Method Summary (collapse)
-
#initialize(name) ⇒ Id
constructor
A new instance of Id.
- #specificity ⇒ Object
- #to_s(opts = {}) ⇒ Object
-
#unify(sels) ⇒ Object
Returns `nil` if `sels` contains an Id selector with a different name than this one.
- #unique? ⇒ Boolean
Methods inherited from Simple
Constructor Details
#initialize(name) ⇒ Id
Returns a new instance of Id
86 87 88 |
# File '.ruby-sass/lib/sass/selector.rb', line 86 def initialize(name) @name = name end |
Constructor Details
#initialize(name) ⇒ Id
Returns a new instance of Id
86 87 88 |
# File '.ruby-sass/lib/sass/selector.rb', line 86 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ String (readonly)
The id name.
83 84 85 |
# File '.ruby-sass/lib/sass/selector.rb', line 83 def name @name end |
Instance Method Details
#specificity ⇒ Object
109 110 111 |
# File '.ruby-sass/lib/sass/selector.rb', line 109 def specificity SPECIFICITY_BASE**2 end |
#to_s(opts = {}) ⇒ Object
95 96 97 |
# File '.ruby-sass/lib/sass/selector.rb', line 95 def to_s(opts = {}) "#" + @name end |
#unify(sels) ⇒ Object
Returns `nil` if `sels` contains an Sass::Selector::Id selector with a different name than this one.
103 104 105 106 |
# File '.ruby-sass/lib/sass/selector.rb', line 103 def unify(sels) return if sels.any? {|sel2| sel2.is_a?(Id) && name != sel2.name} super end |
#unique? ⇒ Boolean
90 91 92 |
# File '.ruby-sass/lib/sass/selector.rb', line 90 def unique? true end |