Sha256: d8d70297401476d07b6581402642a2141ffd21337771ea2425b9d988a7a96370

Contents?: true

Size: 668 Bytes

Versions: 3

Compression:

Stored size: 668 Bytes

Contents

# frozen_string_literal: true

require 'url_finder/version'
require 'url_finder/reader'

# Gem namespace
module UrlFinder
  # Find URLs in file
  # @param [String] path to file
  # @param [String] file_format
  #   of file if nil file format will tried to be infered from
  #   file extension (markdown, html, string)
  def self.from_file(path, file_format = nil)
    file_format ||= path.split('.').last

    from(File.read(path), file_format)
  end

  # Find URLs in string
  # @param [String] content string
  # @param [String] file_format of string (markdown, html, string)
  def self.from(content, file_format)
    Reader.new(content, file_format).urls
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
url_finder-0.2.2 lib/url_finder.rb
url_finder-0.2.1 lib/url_finder.rb
url_finder-0.2.0 lib/url_finder.rb