Sha256: 318330d814d32db83c6c3db727c4f277a8ad4fba7fa4626bbefa95c119f25b8b

Contents?: true

Size: 441 Bytes

Versions: 3

Compression:

Stored size: 441 Bytes

Contents

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

module Wombat
  module PropertyLocator
    include NodeSelector

    def locate_first property
      locate(property).first
    end

    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-0.2.3 lib/wombat/property_locator.rb
wombat-0.2.2 lib/wombat/property_locator.rb
wombat-0.2.0 lib/wombat/property_locator.rb