Method: WebChecker::Http#initialize
- Defined in:
- lib/web_checker/http.rb
#initialize(uri_str, limit = 10) ⇒ Http
Returns a new instance of Http.
10 11 12 13 14 15 16 |
# File 'lib/web_checker/http.rb', line 10 def initialize(uri_str, limit = 10) @uri_str, @limit = uri_str, limit @uri_str = "http://#{@uri_str}" unless @uri_str.include?('://') @uri = URI(@uri_str) raise NotHttpURIError, "Not HTTP URI: #{@uri_str}" unless @uri.scheme.include?('http') raise InvalidHostError, "Domain or host does not exists: #{@uri.host}" unless domain_exists?(@uri.host) end |