4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/wombat/processing/node_selector.rb', line 4
def select_nodes(selector, namespaces = nil)
return [selector.to_s] if selector.is_a? Symbol
if selector.is_a? String
return @context.xpath selector[6..-1], namespaces if selector.start_with? "xpath="
return @context.css selector[4..-1] if selector.start_with? "css="
end
if selector.is_a? Hash
method = selector.flatten.first
selector = selector.flatten.last
return @context.xpath selector, namespaces if method == :xpath
return @context.css selector if method == :css
end
[selector]
end
|