Class: Player

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#capturedObject

Returns the value of attribute captured.



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

def captured
  @captured
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/gorb/player.rb', line 4

def name
  @name
end

#rankObject (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_strObject



12
13
14
# File 'lib/gorb/player.rb', line 12

def to_str
  @name
end