Class: Reactor::XPathExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/reactor/tools/xpath_extractor.rb

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ XPathExtractor

Returns a new instance of XPathExtractor.



3
4
5
# File 'lib/reactor/tools/xpath_extractor.rb', line 3

def initialize(node)
  @node = node
end

Instance Method Details

#match(expr) ⇒ Object



7
8
9
10
11
12
# File 'lib/reactor/tools/xpath_extractor.rb', line 7

def match(expr)
  arr = REXML::XPath.match(@node, expr)

  return arr.first if arr.length == 1
  return arr
end