Sha256: 15ac82ddb4663ae08aa797f0b89cdfe009ec823bd4969e8aad4070928d809ec2
Contents?: true
Size: 737 Bytes
Versions: 4
Compression:
Stored size: 737 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! raise('No url provided') unless @url raise('No xpath provided') unless @xpath text = parse_page @state.value = regex_helper(text) end private def parse_page page = open(@url) # rubocop:disable Security/Open html = Nokogiri::HTML(page) { |config| config.strict.nonet } html.xpath(@xpath).text.strip end def url(value) @url = value end def xpath(value) @xpath = value end end end end
Version data entries
4 entries across 4 versions & 1 rubygems