Sha256: 7acc083140b3431d2c67d9d67be281cae219749bf4eb59db56d363f462873b4b

Contents?: true

Size: 381 Bytes

Versions: 1

Compression:

Stored size: 381 Bytes

Contents

# frozen_string_literal: true

require 'nokogiri'
require 'url_finder/readers/base_reader'

module UrlFinder
  # Find URLs in HTML strings
  class HTMLReader < BaseReader
    # Returns the found URLs
    # @return [Array<String>] the found URLs
    def urls
      document = Nokogiri::HTML(content)
      @urls ||= document.css('a').map { |e| e['href'] }.compact
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
url_finder-0.1.0 lib/url_finder/readers/html_reader.rb