Sha256: b2d12e50092154538327503312b42cd101aa124370eddb8b35c360e66907f064
Contents?: true
Size: 683 Bytes
Versions: 9
Compression:
Stored size: 683 Bytes
Contents
Prospectus.extra_dep('url_xpath', 'nokogiri') require 'open-uri' module LogCabin module Modules ## # Pull state from a GitHub tag module UrlXpath include Prospectus.helpers.find(:regex) def load! fail('No url provided') unless @url fail('No xpath provided') unless @xpath text = parse_page @state.value = regex_helper(text) end private def parse_page page = Nokogiri::HTML(open(@url)) { |config| config.strict.nonet } page.xpath(@xpath).text.strip end def url(value) @url = value end def xpath(value) @xpath = value end end end end
Version data entries
9 entries across 9 versions & 1 rubygems