Class: NetidValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/netid-validator.rb

Class Method Summary collapse

Class Method Details

.do(netid) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/netid-validator.rb', line 2

def self.do(netid)
  response = GenericResponse.new
  if netid.to_s.length > 8 || netid !~ /^[a-zA-Z][\w-]{0,7}$/
    response.response = false
    response.error = 'Not a valid NetID'
  else
    response.response = true
  end
  response
end