lib/sportradar/api/basketball/ncaamb/half.rb in sportradar-api-0.13.4 vs lib/sportradar/api/basketball/ncaamb/half.rb in sportradar-api-0.13.5
- old
+ new
@@ -33,9 +33,18 @@
end
def update(data, **opts)
create_data(@plays_hash, data.dig('events'), klass: Play, api: @api, half: self)
end
+ def plays_by_type(play_type, *types)
+ if types.empty?
+ plays.grep(Play.subclass(play_type.delete('_')))
+ else
+ play_classes = [play_type, *types].map { |type| Play.subclass(type.delete('_')) }
+ plays.select { |play| play_classes.any? { |klass| play.kind_of?(klass) } }
+ end
+ end
+
def plays
@plays_hash.values
end
alias :events :plays