Class: FantasyFootball::Player
- Inherits:
-
Object
- Object
- FantasyFootball::Player
- Defined in:
- lib/fantasy_football/player.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#age ⇒ Object
Returns the value of attribute age.
-
#college ⇒ Object
Returns the value of attribute college.
-
#height ⇒ Object
Returns the value of attribute height.
-
#name ⇒ Object
Returns the value of attribute name.
-
#position ⇒ Object
Returns the value of attribute position.
-
#projection ⇒ Object
Returns the value of attribute projection.
-
#rank ⇒ Object
Returns the value of attribute rank.
-
#team ⇒ Object
Returns the value of attribute team.
-
#url ⇒ Object
Returns the value of attribute url.
-
#week ⇒ Object
Returns the value of attribute week.
-
#weight ⇒ Object
Returns the value of attribute weight.
Class Method Summary collapse
-
.all ⇒ Object
Class variable reader.
- .find_by_position(position) ⇒ Object
- .find_by_rank_and_position(rank, position) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Player
constructor
A new instance of Player.
- #save ⇒ Object
Constructor Details
#initialize ⇒ Player
Returns a new instance of Player.
7 8 9 |
# File 'lib/fantasy_football/player.rb', line 7 def initialize save end |
Instance Attribute Details
#age ⇒ Object
Returns the value of attribute age.
3 4 5 |
# File 'lib/fantasy_football/player.rb', line 3 def age @age end |
#college ⇒ Object
Returns the value of attribute college.
3 4 5 |
# File 'lib/fantasy_football/player.rb', line 3 def college @college end |
#height ⇒ Object
Returns the value of attribute height.
3 4 5 |
# File 'lib/fantasy_football/player.rb', line 3 def height @height end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/fantasy_football/player.rb', line 3 def name @name end |
#position ⇒ Object
Returns the value of attribute position.
3 4 5 |
# File 'lib/fantasy_football/player.rb', line 3 def position @position end |
#projection ⇒ Object
Returns the value of attribute projection.
3 4 5 |
# File 'lib/fantasy_football/player.rb', line 3 def projection @projection end |
#rank ⇒ Object
Returns the value of attribute rank.
3 4 5 |
# File 'lib/fantasy_football/player.rb', line 3 def rank @rank end |
#team ⇒ Object
Returns the value of attribute team.
3 4 5 |
# File 'lib/fantasy_football/player.rb', line 3 def team @team end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/fantasy_football/player.rb', line 3 def url @url end |
#week ⇒ Object
Returns the value of attribute week.
3 4 5 |
# File 'lib/fantasy_football/player.rb', line 3 def week @week end |
#weight ⇒ Object
Returns the value of attribute weight.
3 4 5 |
# File 'lib/fantasy_football/player.rb', line 3 def weight @weight end |
Class Method Details
.all ⇒ Object
Class variable reader
11 12 13 |
# File 'lib/fantasy_football/player.rb', line 11 def self.all # Class variable reader @@all end |
.find_by_position(position) ⇒ Object
19 20 21 |
# File 'lib/fantasy_football/player.rb', line 19 def self.find_by_position(position) all.select {|i| i.position == position.upcase}.sort {|a,b| a.rank.to_i <=> b.rank.to_i} end |
.find_by_rank_and_position(rank, position) ⇒ Object
23 24 25 |
# File 'lib/fantasy_football/player.rb', line 23 def self.find_by_rank_and_position(rank, position) all.find {|i| i.rank == rank && i.position == position.upcase} end |
Instance Method Details
#save ⇒ Object
15 16 17 |
# File 'lib/fantasy_football/player.rb', line 15 def save @@all << self end |