Arie/tf2_line_parser

View on GitHub
lib/tf2_line_parser/events/score.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module TF2LineParser
  module Events
    class Score < Event
      def self.regex_score
        @regex_score ||= '\"(?\'score\'\d+)\"'
      end

      def self.regex_team
        @regex_team ||= 'Team \"(?\'team\'Red|Blue)\"'
      end

      def self.attributes
        @attributes ||= %i[time team score]
      end

      def initialize(time, team, score)
        @time = parse_time(time)
        @team = team
        @score = score
      end
    end
  end
end