Class: Roadie::Selector
- Inherits:
-
Object
- Object
- Roadie::Selector
- Defined in:
- lib/roadie/selector.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(selector) ⇒ Selector
constructor
A new instance of Selector.
- #inlinable? ⇒ Boolean
- #inspect ⇒ Object
- #specificity ⇒ Object
- #to_s ⇒ Object
- #to_str ⇒ Object
Constructor Details
#initialize(selector) ⇒ Selector
Returns a new instance of Selector.
3 4 5 |
# File 'lib/roadie/selector.rb', line 3 def initialize(selector) @selector = selector.to_s.strip end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/roadie/selector.rb', line 22 def ==(other) if other.is_a?(self.class) other.selector == selector else super end end |
#inlinable? ⇒ Boolean
11 12 13 |
# File 'lib/roadie/selector.rb', line 11 def inlinable? !(pseudo_element? || at_rule? || pseudo_function?) end |
#inspect ⇒ Object
20 |
# File 'lib/roadie/selector.rb', line 20 def inspect() selector.inspect end |
#specificity ⇒ Object
7 8 9 |
# File 'lib/roadie/selector.rb', line 7 def specificity @specificity ||= CssParser.calculate_specificity selector end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/roadie/selector.rb', line 15 def to_s selector end |
#to_str ⇒ Object
19 |
# File 'lib/roadie/selector.rb', line 19 def to_str() to_s end |