Class: KillerQueenSceneScoring::Player

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_obj) ⇒ Player

‘config_obj` is a hash that contains the player’s data from the config file.



10
11
12
13
14
# File 'lib/killer_queen_scene_scoring/player.rb', line 10

def initialize(config_obj)
    @name = config_obj[:name]
    @scene = config_obj[:scene]
    @points = 0.0
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/killer_queen_scene_scoring/player.rb', line 6

def name
  @name
end

#pointsObject

Returns the value of attribute points.



7
8
9
# File 'lib/killer_queen_scene_scoring/player.rb', line 7

def points
  @points
end

#sceneObject (readonly)

Returns the value of attribute scene.



6
7
8
# File 'lib/killer_queen_scene_scoring/player.rb', line 6

def scene
  @scene
end

Instance Method Details

#hashObject



16
17
18
# File 'lib/killer_queen_scene_scoring/player.rb', line 16

def hash
    to_s.hash
end

#to_sObject



20
21
22
# File 'lib/killer_queen_scene_scoring/player.rb', line 20

def to_s
    "#{@name} (#{@scene})"
end