Class: YFantasy::League::Standings

Inherits:
BaseSubresource show all
Defined in:
lib/y_fantasy/resources/league/standings.rb

Overview

Standings for a league

Instance Method Summary collapse

Methods inherited from BaseSubresource

dependent?, find, resource_name

Methods included from Subresourceable

included

Instance Method Details

#finalArray<Hash>

Returns an array of team hashes, sorted by rank.

Returns:

  • (Array<Hash>)


14
15
16
# File 'lib/y_fantasy/resources/league/standings.rb', line 14

def final
  teams.map(&:simple_standings).sort_by { |h| h[:rank] }
end

#regular_seasonArray<Hash>

Returns an array of team hashes, sorted by wins and points for.

Returns:

  • (Array<Hash>)


20
21
22
# File 'lib/y_fantasy/resources/league/standings.rb', line 20

def regular_season
  teams.map(&:simple_standings).sort_by { |h| [-h[:wins], -h[:points_for]] }
end