Class: Shared::Player

Inherits:
Object
  • Object
show all
Defined in:
lib/games/shared/player.rb

Direct Known Subclasses

TTT::Player

Instance Attribute Summary collapse

Instance Method Summary collapse

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_levelObject

Returns the value of attribute difficulty_level.



3
4
5
# File 'lib/games/shared/player.rb', line 3

def difficulty_level
  @difficulty_level
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/games/shared/player.rb', line 3

def name
  @name
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/games/shared/player.rb', line 3

def type
  @type
end

#valueObject

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