class Sports::Matchlist
Attributes
matches[R]
use MatchCache/Buffer/Summary/Snippet/Segment/List…
or MatchAnalyzer/Checker/Proofer/Query - why? why not?
Public Class Methods
new( matches )
click to toggle source
:name, :goals, # count of (total) goals - use total_goals - why? why not? :teams, – has its own reader :rounds # note: use if all teams have same match count add last_updated/updated or something - why? why not?
# File lib/sportdb/structs/structs/matchlist.rb, line 16 def initialize( matches ) @matches = matches end
Public Instance Methods
dates_str()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 43 def dates_str() usage.dates_str; end
days()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 44 def days() usage.days; end
end_date()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 40 def end_date() usage.end_date; end
end_date?()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 37 def end_date?() usage.end_date?; end
goals()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 33 def goals() usage.goals; end
has_dates?()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 42 def has_dates?() usage.has_dates?; end
match_counts()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 54 def match_counts() usage.match_counts; end
match_counts_str()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 55 def match_counts_str() usage.match_counts_str; end
rounds()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 47 def rounds() usage.rounds; end
rounds?()
click to toggle source
todo: add has_rounds? alias for rounds? too return true if all match_played in team_usage
are the same
e.g. assumes league with matchday rounds
# File lib/sportdb/structs/structs/matchlist.rb, line 52 def rounds?() usage.rounds?; end
stage_usage()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 59 def stage_usage @stage_usage ||= build_stage_usage( @matches ) @stage_usage end
stages()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 64 def stages() stage_usage.keys; end
start_date()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 39 def start_date() usage.start_date; end
start_date?()
click to toggle source
note: start_date
and end_date
might be nil / optional missing!!!!
# File lib/sportdb/structs/structs/matchlist.rb, line 36 def start_date?() usage.start_date?; end
team_usage()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 26 def team_usage() usage.team_usage; end
teams()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 28 def teams @team_names ||= team_usage.keys.sort @team_names end
usage()
click to toggle source
# File lib/sportdb/structs/structs/matchlist.rb, line 21 def usage @usage ||= build_usage( @matches ) @usage end
Private Instance Methods
build_stage_usage( matches )
click to toggle source
collect usage stats by stage (e.g. regular / playoff / etc.)
# File lib/sportdb/structs/structs/matchlist.rb, line 196 def build_stage_usage( matches ) stages = {} matches.each do |match| stage_key = if match.stage.nil? 'Regular' ## note: assume Regular stage if not defined (AND not explicit unknown) else match.stage end stages[ stage_key ] ||= StatLine.new stages[ stage_key ].update( match ) end stages end
build_usage( matches )
click to toggle source
collect total usage stats (for all matches)
# File lib/sportdb/structs/structs/matchlist.rb, line 187 def build_usage( matches ) stat = StatLine.new matches.each do |match| stat.update( match ) end stat end