Class: Isup

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

Overview

A simple class to determine whether a website is down.

Constant Summary collapse

@@help_string =
"
isup a simple status checker written in Ruby.
\n    Usage:
        isup [url]                  Check the status of [url]
        isup -v/--verbose [url]     Display redirects
        isup -h/--help              Print the help page
\n"

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Isup

Returns a new instance of Isup.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/isup.rb', line 6

def initialize(args)
  args.each do |x|
    @url = x
    @input_good = true
    if (x == "-v") || (x == "--verbose")
      @verbose = true
    elsif (x == "-h") || (x == "--help")
      puts @@help_string
    elsif valid?
      up?
    else
      @input_good = false
    end
  end
  puts "Please input a valid URL." if !@input_good
end