lib/ftc_event/event.rb in ftc_event-0.1.0 vs lib/ftc_event/event.rb in ftc_event-0.1.1

- old
+ new

@@ -16,16 +16,20 @@ def leagues db.execute('SELECT code FROM leagueInfo').map { |row| row['code'] } end + def teams + db.execute('SELECT number FROM teams').map { |row| row['number'] } + end + def code config['code'] end def name - config['name'] + config['name'].gsub(/\s*FTC\s*/, '').strip end def short_name code.upcase end @@ -37,14 +41,24 @@ def end Time.at(config['end'].to_f / 1000.0) end def league(code = leagues.first) - League.new(self, code) + League.new(self, code) if code end def team(number) Team.new(self, number) + end + + def each_team + return enum_for(:each_team) unless block_given? + + teams.each do |number| + yield team(number) + end + + nil end def qualifications Qualifications.new(self) end