Class: RSAC::Selectors::ElementSelector
- Inherits:
-
SimpleSelector
- Object
- Selector
- SimpleSelector
- RSAC::Selectors::ElementSelector
- Defined in:
- lib/antisamy/csspool/rsac/sac/selectors/element_selector.rb
Instance Attribute Summary collapse
-
#local_name ⇒ Object
(also: #name)
readonly
Returns the value of attribute local_name.
Attributes inherited from Selector
Instance Method Summary collapse
- #==(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(name) ⇒ ElementSelector
constructor
A new instance of ElementSelector.
- #specificity ⇒ Object
- #to_css ⇒ Object
- #to_xpath(prefix = true) ⇒ Object
Methods inherited from Selector
Constructor Details
#initialize(name) ⇒ ElementSelector
Returns a new instance of ElementSelector.
7 8 9 10 |
# File 'lib/antisamy/csspool/rsac/sac/selectors/element_selector.rb', line 7 def initialize(name) super(:SAC_ELEMENT_NODE_SELECTOR) @local_name = name end |
Instance Attribute Details
#local_name ⇒ Object (readonly) Also known as: name
Returns the value of attribute local_name.
4 5 6 |
# File 'lib/antisamy/csspool/rsac/sac/selectors/element_selector.rb', line 4 def local_name @local_name end |
Instance Method Details
#==(other) ⇒ Object
26 27 28 |
# File 'lib/antisamy/csspool/rsac/sac/selectors/element_selector.rb', line 26 def ==(other) super && name == other.name end |
#hash ⇒ Object
30 31 32 |
# File 'lib/antisamy/csspool/rsac/sac/selectors/element_selector.rb', line 30 def hash name.hash end |
#specificity ⇒ Object
22 23 24 |
# File 'lib/antisamy/csspool/rsac/sac/selectors/element_selector.rb', line 22 def specificity [0, 0, 0, 1] end |
#to_css ⇒ Object
12 13 14 |
# File 'lib/antisamy/csspool/rsac/sac/selectors/element_selector.rb', line 12 def to_css local_name end |
#to_xpath(prefix = true) ⇒ Object
16 17 18 19 20 |
# File 'lib/antisamy/csspool/rsac/sac/selectors/element_selector.rb', line 16 def to_xpath(prefix=true) atoms = [local_name] atoms.unshift("//") if prefix atoms.join end |