Sha256: b7a0ffb934940be69feed1b6c157280b71d2cb314781e6a802afe4e022874534

Contents?: true

Size: 678 Bytes

Versions: 1

Compression:

Stored size: 678 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, csv, 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, csv, string)
  def self.from(content, file_format)
    Reader.new(content, file_format).urls
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
url_finder-0.1.0 lib/url_finder.rb