Class: Shared::Player
- Inherits:
-
Object
- Object
- Shared::Player
- Defined in:
- lib/games/shared/player.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#difficulty_level ⇒ Object
Returns the value of attribute difficulty_level.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Player
constructor
A new instance of Player.
- #post_initialize(args) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Player
Returns a new instance of Player.
5 6 7 8 9 10 |
# File 'lib/games/shared/player.rb', line 5 def initialize(args = {}) @name = args.fetch(:name, "Player 1") @type = args.fetch(:type, :human) @difficulty_level = args.fetch(:difficulty_level, nil) post_initialize(args) end |
Instance Attribute Details
#difficulty_level ⇒ Object
Returns the value of attribute difficulty_level.
3 4 5 |
# File 'lib/games/shared/player.rb', line 3 def difficulty_level @difficulty_level end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/games/shared/player.rb', line 3 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/games/shared/player.rb', line 3 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
3 4 5 |
# File 'lib/games/shared/player.rb', line 3 def value @value end |
Instance Method Details
#post_initialize(args) ⇒ Object
12 13 |
# File 'lib/games/shared/player.rb', line 12 def post_initialize(args) end |