Class: CodebreakerGem::Player
- Inherits:
-
ValidatedEntity
- Object
- ValidatedEntity
- CodebreakerGem::Player
- Defined in:
- lib/app/entities/player.rb
Constant Summary collapse
- NAME_LENGTH_RANGE =
(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) ⇒ Player
constructor
A new instance of Player.
- #validate ⇒ Object
Methods inherited from ValidatedEntity
Constructor Details
#initialize(name) ⇒ Player
Returns a new instance of Player.
9 10 11 12 |
# File 'lib/app/entities/player.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/player.rb', line 5 def errors @errors end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/app/entities/player.rb', line 5 def name @name end |
Instance Method Details
#validate ⇒ Object
14 15 16 |
# File 'lib/app/entities/player.rb', line 14 def validate @errors << failing.player_name_length unless check_name_length end |