Class: Codebreaker::User
- Inherits:
-
ValidatableEntity
- Object
- ValidatableEntity
- Codebreaker::User
- Defined in:
- lib/app/entities/user.rb
Constant Summary collapse
- VALID_NAME_SIZE =
(3..20).freeze
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ User
constructor
A new instance of User.
- #validate ⇒ Object
Methods inherited from ValidatableEntity
Methods included from Validator
#check_cover?, #check_include?, #check_numbers?, #check_size?
Constructor Details
#initialize(name) ⇒ User
Returns a new instance of User.
9 10 11 12 |
# File 'lib/app/entities/user.rb', line 9 def initialize(name) super() @name = name end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'lib/app/entities/user.rb', line 5 def errors @errors end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/app/entities/user.rb', line 5 def name @name end |
Instance Method Details
#validate ⇒ Object
14 15 16 |
# File 'lib/app/entities/user.rb', line 14 def validate @errors << I18n.t('invalid.cover_error') unless check_cover?(@name, VALID_NAME_SIZE) end |