class Brocli::Initiate

Public Instance Methods

hit(url = Brocli::DEFAULT_URL, time_limit = Brocli::EXECUTION_TIME_LIMIT, time_interval = Brocli::TIME_INTERVAL) click to toggle source
# File lib/brocli/cli.rb, line 27
def hit(url = Brocli::DEFAULT_URL, time_limit = Brocli::EXECUTION_TIME_LIMIT, time_interval = Brocli::TIME_INTERVAL)
  begin
    average_time = client.ping(client.sanitizer(url), time_limit.to_f, time_interval.to_f)
    raise 'There is some error' unless average_time != nil
    puts "Average response time for #{url} is #{(average_time).round(Brocli::DEFAULT_ROUNDING)}s".green
  rescue Exception => e
    puts e.message.red
  end
end

Private Instance Methods

client() click to toggle source
# File lib/brocli/cli.rb, line 38
def client
  @client ||= Brocli::Initiate.new
end