Class: CheckHTTP::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/check_http/cli.rb

Instance Method Summary collapse

Instance Method Details

#perform(url) ⇒ Object



5
6
7
8
# File 'lib/check_http/cli.rb', line 5

def perform(url)
  result = CheckHTTP.check(url.strip)
  puts KV.unparse(result)
end

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/check_http/cli.rb', line 10

def run
  opts = {}
  ARGV.options do |o|
    o.banner = 'Usage: check_http [url]'
    o.parse!

    if url = ARGV.shift
      perform(url)
    else
      ARGF.each_line do |url|
        perform(url)
      end
    end       
  end            
end