Class: Stattr::Player
- Inherits:
-
Object
- Object
- Stattr::Player
- Defined in:
- lib/stattr.rb
Overview
Player class represents a human, who may have multiple character sheets.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#characters ⇒ Object
An array containing Charactersheet objects.
-
#fname ⇒ Object
The First Name of the Player.
-
#lname ⇒ Object
The last Name of the Player.
Instance Method Summary collapse
-
#initialize(fname, lname) ⇒ Player
constructor
Create new Player object.
-
#new_char(name) ⇒ Object
Creates a new randomly generated character associated with Player.
Constructor Details
#initialize(fname, lname) ⇒ Player
Create new Player object
190 191 192 193 194 |
# File 'lib/stattr.rb', line 190 def initialize(fname, lname) @fname = fname @lname = lname @characters = [] end |
Instance Attribute Details
#characters ⇒ Object
An array containing Charactersheet objects
183 |
# File 'lib/stattr.rb', line 183 attr_accessor :fname, :lname, :characters |
#fname ⇒ Object
The First Name of the Player
183 184 185 |
# File 'lib/stattr.rb', line 183 def fname @fname end |
#lname ⇒ Object
The last Name of the Player
183 |
# File 'lib/stattr.rb', line 183 attr_accessor :fname, :lname, :characters |
Instance Method Details
#new_char(name) ⇒ Object
Creates a new randomly generated character associated with Player
200 201 202 203 |
# File 'lib/stattr.rb', line 200 def new_char(name) new_char = CharacterSheet.roll_char(name) self.characters << new_char end |