Sha256: 2aa07002f42af8dcab2f0af21833b3d6bca17328a8e4067a010b36cb8d66cce7

Contents?: true

Size: 503 Bytes

Versions: 4

Compression:

Stored size: 503 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

4 entries across 4 versions & 1 rubygems

Version Path
wombat-0.3.1 lib/wombat/property_locator.rb
wombat-0.3.0 lib/wombat/property_locator.rb
wombat-0.2.5 lib/wombat/property_locator.rb
wombat-0.2.4 lib/wombat/property_locator.rb