Module: Trepan::Validate

Defined in:
app/validate.rb

Class Method Summary collapse

Class Method Details

.line_or_ip(arg_str) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/validate.rb', line 5

def line_or_ip(arg_str)
  arg=arg_str.dup
  is_ip = 
    if 'o' == arg[0..0].downcase
      arg[0] = ''
      true
    else
      false
    end
  line_or_ip = Integer(arg) rescue nil
  if is_ip 
    return line_or_ip, nil
  else
    return nil, line_or_ip
  end
end