lib/sportdb/formats/package.rb in sportdb-formats-1.1.0 vs lib/sportdb/formats/package.rb in sportdb-formats-1.1.1
- old
+ new
@@ -71,10 +71,14 @@
MATCH_CSV_RE = %r{ (?: ^|/ ) # beginning (^) or beginning of path (/)
#{SEASON}
/[a-z0-9_.-]+\.csv$ ## note: allow dot (.) too e.g /eng.1.csv
}x
+ ### add "generic" pattern to find all csv datafiles
+ CSV_RE = %r{ (?: ^|/ )
+ [a-z0-9_.-]+\.csv$ ## note: allow dot (.) too e.g /eng.1.csv
+ }x
## move class-level "static" finders to DirPackage (do NOT work for now for zip packages) - why? why not?
def self.find( path, pattern )
@@ -116,10 +120,11 @@
find( path, MATCH_RE )
end
end
## add match_match and match_match_csv - why? why not?
+
class << self
alias_method :match_teams?, :match_teams
alias_method :teams?, :match_teams
alias_method :match_clubs?, :match_clubs
@@ -210,9 +215,11 @@
else
each( pattern: MATCH_RE, &blk );
end
end
def each_match_csv( &blk ) each( pattern: MATCH_CSV_RE, &blk ); end
+ def each_csv( &blk ) each( pattern: CSV_RE, &blk ); end
+
def each_club_props( &blk ) each( pattern: CLUB_PROPS_RE, &blk ); end
def each_leagues( &blk ) each( pattern: LEAGUES_RE, &blk ); end
def each_clubs( &blk ) each( pattern: CLUBS_RE, &blk ); end
def each_clubs_wiki( &blk ) each( pattern: CLUBS_WIKI_RE, &blk ); end