Class: Roadie::Selector

Inherits:
Object
  • Object
show all
Defined in:
lib/roadie/selector.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


11
12
13
# File 'lib/roadie/selector.rb', line 11

def inlinable?
  !(pseudo_element? || at_rule? || pseudo_function?)
end

#inspectObject



20
# File 'lib/roadie/selector.rb', line 20

def inspect() selector.inspect end

#specificityObject



7
8
9
# File 'lib/roadie/selector.rb', line 7

def specificity
  @specificity ||= CssParser.calculate_specificity selector
end

#to_sObject



15
16
17
# File 'lib/roadie/selector.rb', line 15

def to_s
  selector
end

#to_strObject



19
# File 'lib/roadie/selector.rb', line 19

def to_str() to_s end