Sha256: f87c38c4fd4da8974612a5177bf712f600054e6220f3b2aa13c4be514577f911

Contents?: true

Size: 368 Bytes

Versions: 3

Compression:

Stored size: 368 Bytes

Contents

# frozen_string_literal: true

module SportsManager
  # Public: A team's player in a tournament
  class Participant
    include Comparable

    attr_reader :id, :name

    alias eql? <=>

    def initialize(id:, name:)
      @id = id
      @name = name
    end

    def <=>(other)
      return unless instance_of?(other.class)

      id <=> other.id
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sports-manager-0.0.3 lib/sports_manager/participant.rb
sports-manager-0.0.2 lib/sports_manager/participant.rb
sports-manager-0.0.1 lib/sports_manager/participant.rb