Class: HTTPResponseCode::Test::PresenceTester
- Inherits:
-
Object
- Object
- HTTPResponseCode::Test::PresenceTester
- Defined in:
- lib/http_response_code/test/presence_tester.rb
Instance Method Summary collapse
- #each_site(&block) ⇒ Object
-
#initialize(params) ⇒ PresenceTester
constructor
A new instance of PresenceTester.
- #run_test ⇒ Object
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_test ⇒ Object
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..upcase}: ".colorize(response_color(res.code)) + "#{create_link(site)}" end finish_test error_count end |