23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/sportdb/config/league_reader.rb', line 23
def self.parse( txt )
hash = {}
season = '*'
txt.each_line do |line|
line = line.strip
next if line.empty?
next if line.start_with?( '#' )
line = line.sub( /#.*/, '' ).strip
pp line
if (m=line.match( SEASON_REGEX ))
season = m[:season]
else
key_line, values_line = line.split( '=>' )
values = values_line.split( ',' )
key_line = key_line.strip
values = values.map { |value| value.strip }
pp values
league_key = key_line
league_basename = values[0]
hash[season] ||= {}
hash[season][league_key] = league_basename
end
end
hash
end
|