Class: Sass::Selector::AbstractSequence
- Inherits:
-
Object
- Object
- Sass::Selector::AbstractSequence
- Defined in:
- .ruby-sass/lib/sass/selector/abstract_sequence.rb
Overview
The abstract parent class of the various selector sequence classes.
All subclasses should implement a `members` method that returns an array of object that respond to `#line=` and `#filename=`, as well as a `to_s` method that returns the string representation of the selector.
Direct Known Subclasses
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
#filename ⇒ String?
The name of the file in which this selector was declared.
-
#line ⇒ Integer
The line of the Sass template on which this selector was declared.
Instance Method Summary (collapse)
-
#eql?(other) ⇒ Boolean
(also: #==)
Checks equality between this and another object.
-
#hash ⇒ Integer
Returns a hash code for this sequence.
-
#invisible? ⇒ Boolean
Whether or not this selector should be hidden due to containing a placeholder.
-
#specificity ⇒ Integer, Range
Returns the specificity of the selector.
-
#to_s(opts = {}) ⇒ String
Returns the selector string.
Instance Attribute Details
#filename ⇒ String?
The name of the file in which this selector was declared.
17 18 19 |
# File '.ruby-sass/lib/sass/selector/abstract_sequence.rb', line 17 def filename @filename end |
#line ⇒ Integer
The line of the Sass template on which this selector was declared.
12 13 14 |
# File '.ruby-sass/lib/sass/selector/abstract_sequence.rb', line 12 def line @line end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
Checks equality between this and another object.
Subclasses should define `#_eql?` rather than overriding this method, which handles checking class equality and hash equality.
57 58 59 |
# File '.ruby-sass/lib/sass/selector/abstract_sequence.rb', line 57 def eql?(other) other.class == self.class && other.hash == hash && _eql?(other) end |
#hash ⇒ Integer
Returns a hash code for this sequence.
Subclasses should define `#_hash` rather than overriding this method, which automatically handles memoizing the result.
46 47 48 |
# File '.ruby-sass/lib/sass/selector/abstract_sequence.rb', line 46 def hash @_hash ||= _hash end |
#invisible? ⇒ Boolean
Whether or not this selector should be hidden due to containing a placeholder.
64 65 66 67 68 69 |
# File '.ruby-sass/lib/sass/selector/abstract_sequence.rb', line 64 def invisible? @invisible ||= members.any? do |m| next m.invisible? if m.is_a?(AbstractSequence) || m.is_a?(Pseudo) m.is_a?(Placeholder) end end |
#specificity ⇒ Integer, Range
Returns the specificity of the selector.
The base is given by SPECIFICITY_BASE. This can be a number or a range representing possible specificities.
88 89 90 |
# File '.ruby-sass/lib/sass/selector/abstract_sequence.rb', line 88 def specificity _specificity(members) end |