Sha256: 88560cfc3d1327601bdf54ce40511475b5c04b6ac9503aab87e843b4035de8ff

Contents?: true

Size: 556 Bytes

Versions: 2

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

module FtcEvent
  class Eliminations
    attr_reader :event

    def initialize(event)
      @event = event
    end

    def name
      'Eliminations'
    end

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

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

    def each_match
      return enum_for(:each_match) unless block_given?

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

      nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ftc_event-0.1.1 lib/ftc_event/eliminations.rb
ftc_event-0.1.0 lib/ftc_event/eliminations.rb