Class: Player
- Inherits:
-
Object
- Object
- Player
- Defined in:
- lib/redbull_team/player.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#age ⇒ Object
Returns the value of attribute age.
-
#height ⇒ Object
Returns the value of attribute height.
-
#name ⇒ Object
Returns the value of attribute name.
-
#position ⇒ Object
Returns the value of attribute position.
-
#weight ⇒ Object
Returns the value of attribute weight.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ Player
constructor
A new instance of Player.
Constructor Details
#initialize(hash) ⇒ Player
Returns a new instance of Player.
4 5 6 7 |
# File 'lib/redbull_team/player.rb', line 4 def initialize(hash) hash.each{|key, value| self.send("#{key}=", value)} self.class.all << self end |
Instance Attribute Details
#age ⇒ Object
Returns the value of attribute age.
2 3 4 |
# File 'lib/redbull_team/player.rb', line 2 def age @age end |
#height ⇒ Object
Returns the value of attribute height.
2 3 4 |
# File 'lib/redbull_team/player.rb', line 2 def height @height end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/redbull_team/player.rb', line 2 def name @name end |
#position ⇒ Object
Returns the value of attribute position.
2 3 4 |
# File 'lib/redbull_team/player.rb', line 2 def position @position end |
#weight ⇒ Object
Returns the value of attribute weight.
2 3 4 |
# File 'lib/redbull_team/player.rb', line 2 def weight @weight end |
Class Method Details
.all ⇒ Object
8 9 10 |
# File 'lib/redbull_team/player.rb', line 8 def self.all @@all end |
.count ⇒ Object
14 15 16 |
# File 'lib/redbull_team/player.rb', line 14 def self.count self.all.length end |
.reset ⇒ Object
11 12 13 |
# File 'lib/redbull_team/player.rb', line 11 def self.reset self.all.clear end |