Class: HTTPResponseCode::Test::PresenceTester

Inherits:
Object
  • Object
show all
Defined in:
lib/http_response_code/test/presence_tester.rb

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ PresenceTester

Returns a new instance of PresenceTester.



5
6
7
8
9
# File 'lib/http_response_code/test/presence_tester.rb', line 5

def initialize(params)
  @site   = params[:site]
  @domain = params[:domain]
  @sites  = text_to_array(@site)
end

Instance Method Details

#each_site(&block) ⇒ Object



21
22
23
24
25
# File 'lib/http_response_code/test/presence_tester.rb', line 21

def each_site(&block)
  @sites.each do |site|
    yield site
  end
end

#run_testObject



11
12
13
14
15
16
17
18
19
# File 'lib/http_response_code/test/presence_tester.rb', line 11

def run_test
  error_count = 0
  each_site do |site|
    res = response(site)
    puts "[#{res.code}] #{res.message.upcase}:
    ".colorize(response_color(res.code)) + "#{create_link(site)}"
  end
  finish_test error_count
end