Class: Password
- Inherits:
-
Object
- Object
- Password
- Defined in:
- lib/ppg/password.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
(also: #to_s)
Returns the value of attribute password.
-
#PASSWORD_LENGTH ⇒ Object
readonly
Returns the value of attribute PASSWORD_LENGTH.
-
#password_pattern ⇒ Object
Returns the value of attribute password_pattern.
Instance Method Summary collapse
-
#initialize(password_length, password_pattern = nil) ⇒ Password
constructor
A new instance of Password.
- #length=(password_length) ⇒ Object
Constructor Details
#initialize(password_length, password_pattern = nil) ⇒ Password
Returns a new instance of Password.
5 6 7 8 9 10 11 |
# File 'lib/ppg/password.rb', line 5 def initialize (password_length, password_pattern = nil) raise ArgumentError, "length must be > 0" if password_length <= 0 @PASSWORD_LENGTH = password_length.freeze @password = String.new #TODO: make password_pattern validation check method @password_pattern ||= [] end |
Instance Attribute Details
#password ⇒ Object Also known as: to_s
Returns the value of attribute password.
2 3 4 |
# File 'lib/ppg/password.rb', line 2 def password @password end |
#PASSWORD_LENGTH ⇒ Object (readonly)
Returns the value of attribute PASSWORD_LENGTH.
3 4 5 |
# File 'lib/ppg/password.rb', line 3 def PASSWORD_LENGTH @PASSWORD_LENGTH end |
#password_pattern ⇒ Object
Returns the value of attribute password_pattern.
2 3 4 |
# File 'lib/ppg/password.rb', line 2 def password_pattern @password_pattern end |
Instance Method Details
#length=(password_length) ⇒ Object
13 14 15 16 |
# File 'lib/ppg/password.rb', line 13 def length= (password_length) raise ArgumentError, "length must be > 0" if password_length <= 0 @PASSWORD_LENGTH = password_length.freeze end |