Class: FtcEvent::Qualifications

Inherits:
Object
  • Object
show all
Defined in:
lib/ftc_event/qualifications.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ Qualifications

Returns a new instance of Qualifications.



7
8
9
# File 'lib/ftc_event/qualifications.rb', line 7

def initialize(event)
  @event = event
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



5
6
7
# File 'lib/ftc_event/qualifications.rb', line 5

def event
  @event
end

Instance Method Details

#each_matchObject



23
24
25
26
27
28
29
30
31
# File 'lib/ftc_event/qualifications.rb', line 23

def each_match
  return enum_for(:each_match) unless block_given?

  matches.each do |match_number|
    yield match(match_number)
  end

  nil
end

#match(match_number) ⇒ Object



15
16
17
# File 'lib/ftc_event/qualifications.rb', line 15

def match(match_number)
  Qualification.new(event, match_number)
end

#matchesObject



19
20
21
# File 'lib/ftc_event/qualifications.rb', line 19

def matches
  event.db.query('SELECT match FROM quals').map { |row| row['match'] }
end

#nameObject



11
12
13
# File 'lib/ftc_event/qualifications.rb', line 11

def name
  'Qualifications'
end