Sha256: 6b4fca30710d0e1d93cb7e889b69cd68fba2d185150a1486574983d9a231d68f

Contents?: true

Size: 505 Bytes

Versions: 3

Compression:

Stored size: 505 Bytes

Contents

#coding: utf-8
require 'wombat/node_selector'

module Wombat
  module PropertyLocator
    include NodeSelector

    def locate(property)
      props = _locate property
      property.format != :list ? props.first : props
    end

    private
    def _locate(property)
      result = select_nodes(property.selector, property.namespaces).to_a
      result.map! {|r| r.inner_html.strip } if property.format == :html
      result.map {|r| r.kind_of?(String) ? r : r.inner_text }.map(&:strip)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wombat-1.0.0 lib/wombat/property_locator.rb
wombat-0.5.0 lib/wombat/property_locator.rb
wombat-0.4.0 lib/wombat/property_locator.rb