Class: Username

Inherits:
Object
  • Object
show all
Defined in:
backend/app/lib/username.rb

Class Method Summary collapse

Class Method Details

.value(s) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'backend/app/lib/username.rb', line 2

def self.value(s)
  s = s.downcase.strip

  if s !~ /\A[a-zA-Z0-9\-_. @]+\z/ || s =~ /  +/
    raise InvalidUsernameException.new
  end

  s
end