blamestella.com/ => blamestella.com blamestella.com/ => blamestella.com:443
# File lib/stella.rb, line 161 def canonical_host(host) return nil if host.nil? if host.kind_of?(URI) uri = host else host &&= host.to_s host.strip! host = host.to_s unless String === host host = "http://#{host}" unless host.match(/^https?:\/\//) uri = URI.parse(host) end str = "#{uri.host}".downcase #str << ":#{uri.port}" if uri.port && uri.port != 80 str end
# File lib/stella.rb, line 177 def canonical_uri(uri) return nil if uri.nil? if uri.kind_of?(URI) uri = Addressable::URI.parse uri.to_s elsif uri.kind_of?(String) uri &&= uri.to_s uri.strip! unless uri.frozen? uri = "http://#{uri}" unless uri.match(/^https?:\/\//) uri = Addressable::URI.parse(uri) end uri.scheme ||= 'http' uri.path = '/' if uri.path.to_s.empty? uri end
# File lib/stella.rb, line 150 def checkup(uri, opts={}) plan = Stella::Testplan.new uri run = Stella::Testrun.new plan, :checkup, opts Stella::Engine.run run run end
# File lib/stella.rb, line 139 def get(uri, opts={}) opts[:concurrency] ||= 1 opts[:repetitions] ||= 1 run = checkup uri, opts report = run.report if report.processed? && report.content && report.statuses.success? report.content.response_body else nil end end
# File lib/stella.rb, line 133 def ld(*msg) return unless Stella.debug? prefix = "D(#{Thread.current.object_id}): " li("#{prefix}#{msg.join("#{$/}#{prefix}")}") end
# File lib/stella.rb, line 132 def le(*msg); li " " << msg.join("#{$/} ") end
# File lib/stella.rb, line 131 def li(*msg) STDERR.puts *msg unless quiet? end
Generated with the Darkfish Rdoc Generator 2.