class Xembly::Xpath
XPATH directive
Public Class Methods
new(path)
click to toggle source
Ctor.
path
-
Path
# File lib/xembly/xpath.rb, line 31 def initialize(path) @path = path end
Public Instance Methods
exec(dom, cursor)
click to toggle source
# File lib/xembly/xpath.rb, line 35 def exec(dom, cursor) if @path.start_with?('/') after = dom.xpath(@path) else after = [] cursor.each do |node| node.xpath(@path).each { |n| after.push(n) } end end after end