Class: Fbgen::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/football-sources/process.rb

Overview

todo/check: use a module (NOT a class) - why? why not?

Class Method Summary collapse

Class Method Details

.convert(datasets, source:) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/football-sources/process.rb', line 22

def self.convert( datasets, source: )
  datasets.each_with_index do |dataset,i|
    league  = dataset[0]
    seasons = dataset[1]

    puts "converting [#{i+1}/#{datasets.size}] #{league}..."
    seasons.each_with_index do |season,j|
      puts "  season [#{j+1}/#{season.size}] #{league} #{season}..."
      source.convert( league: league,
                      season: season )
    end
  end
end

.download(datasets, source:) ⇒ Object

note - source expected module/class e.g. Footballdata/Worldfootball e.g.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/football-sources/process.rb', line 8

def self.download( datasets, source: )
  datasets.each_with_index do |dataset,i|
    league  = dataset[0]
    seasons = dataset[1]

    puts "downloading [#{i+1}/#{datasets.size}] #{league}..."
    seasons.each_with_index do |season,j|
      puts "  season [#{j+1}/#{season.size}] #{league} #{season}..."
      source.schedule( league: league,
                       season: season )
    end
  end
end