Class: Player
- Inherits:
-
Object
- Object
- Player
- Defined in:
- lib/gorb/player.rb
Instance Attribute Summary collapse
-
#captured ⇒ Object
Returns the value of attribute captured.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rank ⇒ Object
readonly
Returns the value of attribute rank.
Instance Method Summary collapse
-
#initialize(name = "Anonymous", rank = nil) ⇒ Player
constructor
A new instance of Player.
- #to_str ⇒ Object
Constructor Details
#initialize(name = "Anonymous", rank = nil) ⇒ Player
Returns a new instance of Player.
6 7 8 9 10 |
# File 'lib/gorb/player.rb', line 6 def initialize(name="Anonymous", rank=nil) @name = name @rank = rank @captured = 0 end |
Instance Attribute Details
#captured ⇒ Object
Returns the value of attribute captured.
3 4 5 |
# File 'lib/gorb/player.rb', line 3 def captured @captured end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/gorb/player.rb', line 4 def name @name end |
#rank ⇒ Object (readonly)
Returns the value of attribute rank.
4 5 6 |
# File 'lib/gorb/player.rb', line 4 def rank @rank end |
Instance Method Details
#to_str ⇒ Object
12 13 14 |
# File 'lib/gorb/player.rb', line 12 def to_str @name end |