lib/sportradar/api/nfl/depth_chart.rb in sportradar-api-0.9.3 vs lib/sportradar/api/nfl/depth_chart.rb in sportradar-api-0.9.5
- old
+ new
@@ -18,14 +18,16 @@
end
private
def teams
- @teams ||= Hash.new { |hash, number| hash[number] = generate_team(number) }
+ @teams ||= populate_teams
end
def populate_teams
- (1..3).each(&method(:team)) if teams.empty?
+ (1..3).each_with_object({}) do |i, hash|
+ hash[i] = generate_team(i)
+ end
end
def generate_team(number)
@chart.each_with_object({}) do |(pos_name, groups), memo|
memo[pos_name] = groups[number.to_s]