lib/website_checker.rb
# Runs actual check of hosts loaded from `input_file`
# @return [Array<Hash>] array of hashes with keys `:host`, `:result`
# @raise [Errno::ENOENT] if `input_file` not exists
# @raise [UnableToFindHeader] if expected {HEADER} not found in CSV
Runs actual check of hosts loaded from `input_file`
Runs actual check of hosts loaded from ` input_file `
def run
    results = []
    csv = CSV.open(input_file, headers: true).read
    unless csv.headers.include?(HEADER)
      raise UnableToFindHeader, "File #{input_file} does not contain header #{HEADER.inspect}"
    end
    csv.each do |row|
      results << { host: row[HEADER], result: check(row[HEADER]) }
    end
    results
  end
def run results = [ ] csv = CSV . open ( input_file , headers : true ) . read unless csv . headers . include? ( HEADER ) raise UnableToFindHeader , "File #{input_file} does not contain header #{HEADER.inspect}" end csv . each do | row | results << { host : row [ HEADER ] , result : check ( row [ HEADER ] ) } end results end
Runs actual check of hosts loaded from `input_file`
Runs actual check of hosts loaded from ` input_file `
array of hashes with keys `:host`, `:result`
array of hashes with keys ` : host ` ` : result `
Array<Hash>
[Errno::ENOENT] if `input_file` not exists
[ Errno :: ENOENT ] if ` input_file ` not exists
[UnableToFindHeader] if expected {HEADER} not found in CSV
[ UnableToFindHeader ] if expected { HEADER } not found in CSV