lib/sportradar/api/football/ncaafb/drive.rb in sportradar-api-0.11.17 vs lib/sportradar/api/football/ncaafb/drive.rb in sportradar-api-0.11.18
- old
+ new
@@ -12,14 +12,14 @@
create_data(@plays_hash, data['actions'], klass: Play, api: api, game: self) if data['actions']
create_data(@events_hash, data['events'], klass: Event, api: api, game: self) if data['events']
end
def play_count
- plays.count { |play| ['rush', 'pass'].include? play.play_type }
+ plays.count(&:counted_play?)
end
def gain
- Array(plays.select { |play| ['rush', 'pass'].include? play.play_type }).sum do |play|
+ Array(plays.select(&:counted_play?)).sum do |play|
Array(play.players).sum do |p|
p.dig('passing', 'yds').to_i + p.dig('rushing', 'yds').to_i
end
end
end