Class: GatesOfHeaven::Doorman

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

Instance Method Summary collapse

Constructor Details

#initialize(password) ⇒ Doorman

Returns a new instance of Doorman.



3
4
5
# File 'lib/gates_of_heaven/doorman.rb', line 3

def initialize(password)
  @password = password.dup
end

Instance Method Details

#guardObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/gates_of_heaven/doorman.rb', line 7

def guard
  case
  when @password.length <= 6
    'Password too short'
  when !@password.match(/\d/)
    'Password needs numbers'
  else
    nil
  end
end