Class: Datafile::FootballDataset
- Defined in:
- lib/datafile/dataset.rb
Instance Attribute Summary
Attributes inherited from Dataset
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name_easy, opts = {}) ⇒ FootballDataset
constructor
A new instance of FootballDataset.
Methods inherited from Dataset
Constructor Details
#initialize(name_easy, opts = {}) ⇒ FootballDataset
Returns a new instance of FootballDataset.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/datafile/dataset.rb', line 93 def initialize( name_easy, opts={} ) ## check if name include slash (e.g. /) ## - if not auto-add openfootball/ (default) if name_easy.index( '/' ).nil? if opts[:format] == 'csv' name = "footballcsv/#{name_easy}" else name = "openfootball/#{name_easy}" end 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 self.class.known_datasets.include?( name ) ## todo: use logger - why, why not?? puts "*** warn: unknown football dataset '#{name}', typo ???" end end |
Class Method Details
.build_known_datasets ⇒ Object
83 84 85 |
# File 'lib/datafile/dataset.rb', line 83 def self.build_known_datasets read_known_datasets( "#{::Datafile.data_path}/football.txt" ) end |
.known_datasets ⇒ Object
87 88 89 90 |
# File 'lib/datafile/dataset.rb', line 87 def self.known_datasets @@known_football_datasets ||= build_known_datasets @@known_football_datasets end |