Class: Reactor::XPathExtractor
- Inherits:
-
Object
- Object
- Reactor::XPathExtractor
- Defined in:
- lib/reactor/tools/xpath_extractor.rb
Instance Method Summary collapse
-
#initialize(node) ⇒ XPathExtractor
constructor
A new instance of XPathExtractor.
- #match(expr) ⇒ Object
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 |