Class: Sports::Matchlist

Inherits:
Object
  • Object
show all
Defined in:
lib/sportdb/structs/structs/matchlist.rb

Overview

todo: find a better name - MatchStats, MatchFixtures, MatchSchedule, …

Defined Under Namespace

Classes: StatLine

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(matches) ⇒ Matchlist

add last_updated/updated or something - why? why not?



16
17
18
# File 'lib/sportdb/structs/structs/matchlist.rb', line 16

def initialize( matches )
  @matches = matches
end

Instance Attribute Details

#matchesObject (readonly)

use MatchCache/Buffer/Summary/Snippet/Segment/List…

or MatchAnalyzer/Checker/Proofer/Query - why? why not?


9
10
11
# File 'lib/sportdb/structs/structs/matchlist.rb', line 9

def matches
  @matches
end

Instance Method Details

#dates_strObject



43
# File 'lib/sportdb/structs/structs/matchlist.rb', line 43

def dates_str()   usage.dates_str; end

#daysObject



44
# File 'lib/sportdb/structs/structs/matchlist.rb', line 44

def days()        usage.days; end

#end_dateObject



40
# File 'lib/sportdb/structs/structs/matchlist.rb', line 40

def end_date()    usage.end_date; end

#end_date?Boolean

Returns:

  • (Boolean)


37
# File 'lib/sportdb/structs/structs/matchlist.rb', line 37

def end_date?()   usage.end_date?; end

#goalsObject



33
# File 'lib/sportdb/structs/structs/matchlist.rb', line 33

def goals() usage.goals; end

#has_dates?Boolean

Returns:

  • (Boolean)


42
# File 'lib/sportdb/structs/structs/matchlist.rb', line 42

def has_dates?()  usage.has_dates?; end

#match_countsObject



54
# File 'lib/sportdb/structs/structs/matchlist.rb', line 54

def match_counts() usage.match_counts; end

#match_counts_strObject



55
# File 'lib/sportdb/structs/structs/matchlist.rb', line 55

def match_counts_str() usage.match_counts_str; end

#roundsObject



47
# File 'lib/sportdb/structs/structs/matchlist.rb', line 47

def rounds() usage.rounds; end

#rounds?Boolean

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

Returns:

  • (Boolean)


52
# File 'lib/sportdb/structs/structs/matchlist.rb', line 52

def rounds?() usage.rounds?; end

#stage_usageObject



59
60
61
62
# File 'lib/sportdb/structs/structs/matchlist.rb', line 59

def stage_usage
  @stage_usage ||= build_stage_usage( @matches )
  @stage_usage
end

#stagesObject

note: returns empty array for stages for now - why? why not?



64
# File 'lib/sportdb/structs/structs/matchlist.rb', line 64

def stages() stage_usage.keys; end

#start_dateObject



39
# File 'lib/sportdb/structs/structs/matchlist.rb', line 39

def start_date()  usage.start_date; end

#start_date?Boolean

note: start_date and end_date might be nil / optional missing!!!!

Returns:

  • (Boolean)


36
# File 'lib/sportdb/structs/structs/matchlist.rb', line 36

def start_date?() usage.start_date?; end

#team_usageObject



26
# File 'lib/sportdb/structs/structs/matchlist.rb', line 26

def team_usage() usage.team_usage; end

#teamsObject



28
29
30
31
# File 'lib/sportdb/structs/structs/matchlist.rb', line 28

def teams
  @team_names ||= team_usage.keys.sort
  @team_names
end

#usageObject



21
22
23
24
# File 'lib/sportdb/structs/structs/matchlist.rb', line 21

def usage
  @usage ||= build_usage( @matches )
  @usage
end