Class: Nokogiri::XML::Node
- Inherits:
-
Object
- Object
- Nokogiri::XML::Node
- Defined in:
- lib/chainsaw/ext/nokogiri.rb
Instance Method Summary collapse
- #fix_xpath(*paths) ⇒ Object
- #original_search ⇒ Object
- #original_xpath ⇒ Object
- #search(*paths) ⇒ Object
- #xpath(*paths) ⇒ Object
Instance Method Details
#fix_xpath(*paths) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/chainsaw/ext/nokogiri.rb', line 6 def fix_xpath(*paths) paths.map do |path| if path.is_a? String # fix for id() func path.sub(/^id\(\s*["']([^"']*)["']\s*\)/, './/*[@id="\1"]') else path end end end |
#original_search ⇒ Object
17 |
# File 'lib/chainsaw/ext/nokogiri.rb', line 17 alias original_search search |
#original_xpath ⇒ Object
22 |
# File 'lib/chainsaw/ext/nokogiri.rb', line 22 alias original_xpath xpath |
#search(*paths) ⇒ Object
18 19 20 |
# File 'lib/chainsaw/ext/nokogiri.rb', line 18 def search(*paths) original_search(*fix_xpath(*paths)) end |
#xpath(*paths) ⇒ Object
23 24 25 |
# File 'lib/chainsaw/ext/nokogiri.rb', line 23 def xpath(*paths) original_xpath(*fix_xpath(*paths)) end |