Class: Datafile::FootballDataset

Inherits:
Dataset
  • Object
show all
Defined in:
lib/datafile/datasets/dataset.rb

Constant Summary collapse

@@known_football_datasets =
nil

Instance Attribute Summary

Attributes inherited from Dataset

#name, #opts

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Dataset

#file?, #setup

Constructor Details

#initialize(name_easy, opts = {}) ⇒ FootballDataset

Returns a new instance of FootballDataset.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/datafile/datasets/dataset.rb', line 99

def initialize( name_easy, opts={} )

  ## check if name include slash (e.g. /)
  ##  - if not auto-add openfootball/ (default)
  if name_easy.index( '/' ).nil?
    name = "openfootball/#{name_easy}"
  else
    name = name_easy   ## just pass through for now
  end

  super( name, opts )

  ### check for known datasets; warn: if not known (might be a typo)
  unless FootballDataset.known_datasets.include?( name )
    ## todo: use logger - why, why not??
    puts "*** warn: unknown football dataset '#{name}', typo ???"
  end
end

Class Method Details

.known_datasetsObject



89
90
91
92
93
94
95
96
# File 'lib/datafile/datasets/dataset.rb', line 89

def self.known_datasets
  ## return array of known datasets
  ### todo/fix - use \\= idiom - why, why not??
  if @@known_football_datasets.nil?
    @@known_football_datasets = read_known_datasets( "#{::Datafile.data_path}/football.txt" )
  end
  @@known_football_datasets
end

Instance Method Details

#file_workerObject



119
# File 'lib/datafile/datasets/dataset.rb', line 119

def file_worker()  FootballFileDataset.new( self ); end

#zip_workerObject



118
# File 'lib/datafile/datasets/dataset.rb', line 118

def zip_worker()   FootballZipDataset.new( self );  end