Class: Wombat::Property::Locators::Text

Inherits:
Base
  • Object
show all
Defined in:
lib/wombat/property/locators/text.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Wombat::Processing::NodeSelector

#select_nodes

Constructor Details

This class inherits a constructor from Wombat::Property::Locators::Base

Instance Method Details

#locate(context, page = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/wombat/property/locators/text.rb', line 7

def locate(context, page = nil)
  node = locate_nodes(context)
  node = node.first unless node.is_a?(String)

  value = 
    unless node
      nil
    else 
      node.is_a?(String) ? node.strip : node.inner_text.strip
    end
    
  super { value }
end