lib/sportdb/formats/package.rb in sportdb-formats-1.1.1 vs lib/sportdb/formats/package.rb in sportdb-formats-1.1.2

- old
+ new

@@ -11,16 +11,26 @@ }x ## leagues.txt or leagues_en.txt ## remove support for en.leagues.txt - why? why not? LEAGUES_RE = %r{ (?: ^|/ ) # beginning (^) or beginning of path (/) - (?: [a-z]{1,4}\. )? # optional country code/key e.g. eng.clubs.wiki.txt + (?: [a-z]{1,4}\. )? # optional country code/key e.g. eng.leagues.txt leagues (?:_[a-z0-9_-]+)? \.txt$ }x + ## seasons.txt or seasons_en.txt + ## remove support for br.seasons.txt - why? why not? + SEASONS_RE = %r{ (?: ^|/ ) # beginning (^) or beginning of path (/) + (?: [a-z]{1,4}\. )? # optional country code/key e.g. eng.seasons.txt + seasons + (?:_[a-z0-9_-]+)? + \.txt$ + }x + + ## clubs.txt or clubs_en.txt ## remove support for en.clubs.txt - why? why not? CLUBS_RE = %r{ (?: ^|/ ) # beginning (^) or beginning of path (/) (?: [a-z]{1,4}\. )? # optional country code/key e.g. eng.clubs.txt clubs @@ -47,10 +57,12 @@ teams (?:_[a-z0-9_-]+)? \.txt$ }x + + ### todo/fix: change SEASON_RE to SEASON_KEY_RE (avoid confusion w/ SEASONS_RE for datafile?) - why? why not? !!!!!!! ### season folder: ## e.g. /2019-20 or ## year-only e.g. /2019 or ## /2016--france SEASON_RE = %r{ (?: @@ -108,10 +120,14 @@ def self.match_club_props( path, pattern: CLUB_PROPS_RE ) pattern.match( path ); end def self.find_leagues( path, pattern: LEAGUES_RE ) find( path, pattern ); end def self.match_leagues( path ) LEAGUES_RE.match( path ); end + def self.find_seasons( path, pattern: SEASONS_RE ) find( path, pattern ); end + def self.match_seasons( path ) SEASONS_RE.match( path ); end + + def self.find_conf( path, pattern: CONF_RE ) find( path, pattern ); end def self.match_conf( path ) CONF_RE.match( path ); end def self.find_match( path, format: 'txt' ) if format == 'csv' @@ -136,9 +152,12 @@ alias_method :match_club_props?, :match_club_props alias_method :club_props?, :match_club_props alias_method :match_leagues?, :match_leagues alias_method :leagues?, :match_leagues + + alias_method :match_seasons?, :match_seasons + alias_method :seasons?, :match_seasons alias_method :match_conf?, :match_conf alias_method :conf?, :match_conf end