Sha256: 3c5112332f600d292c53a1fcd990ccad7f750c96e3f3bdcf3303aab9190693bf
Contents?: true
Size: 908 Bytes
Versions: 3
Compression:
Stored size: 908 Bytes
Contents
# frozen_string_literal: true require 'verify_redirects/version' require 'verify_redirects/verifier' module VerifyRedirects def self.from_csv(input_path:, output_path:) verifier = Verifier.new input_csv = HoneyFormat::CSV.new(File.read(input_path)) header = %w[success from redirected_to expected_redirect] rows = input_csv.rows.map do |row| result = verifier.call(row.from_url, row.to_url) yield(result) if block_given? result.to_a end output_csv = HoneyFormat::Matrix.new(rows, header: header).to_csv File.write(output_path, output_csv) end def self.configuration @configuration ||= Configuration.new end def self.config configuration end def self.configure yield(configuration) if block_given? configuration end class Configuration attr_accessor :debug def initialize @debug = false end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
verify_redirects-0.2.1 | lib/verify_redirects.rb |
verify_redirects-0.2.0 | lib/verify_redirects.rb |
verify_redirects-0.1.1 | lib/verify_redirects.rb |