Sha256: 4390eb589c939fca6347ad083ec73381319a0e208a6be03bb9b26c15eec48a72
Contents?: true
Size: 513 Bytes
Versions: 11
Compression:
Stored size: 513 Bytes
Contents
module SportsDataApi module Mlb class Scoring attr_reader :scoring def initialize(scoring) @scoring = scoring end def inning @inning ||= last_inning ? last_inning['number'] : nil end def inning_half return unless last_inning @inning_half ||= last_inning['runs'] == 'X' ? 'top' : 'bot' end private def last_inning @last_inning ||= (scoring || []).sort_by { |i| i['number'] }.last end end end end
Version data entries
11 entries across 11 versions & 1 rubygems