Sha256: e8c2dde7f594a87dcc838d18a11a87c6e8436c813d9585e25486426502fe2f60

Contents?: true

Size: 576 Bytes

Versions: 9

Compression:

Stored size: 576 Bytes

Contents

# frozen_string_literal: true

module Basketball
  module Org
    # Base class describing a player.
    # A consumer application should extend these specific to their specific sports traits.
    class Player < Entity
      attr_reader :overall, :position

      def initialize(id:, overall: 0, position: nil)
        super(id)

        raise ArgumentError, 'position is required' unless position

        @overall  = overall
        @position = position

        freeze
      end

      def to_s
        "[#{super}] (#{position}) #{overall}".strip
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
basketball-0.0.17 lib/basketball/org/player.rb
basketball-0.0.16 lib/basketball/org/player.rb
basketball-0.0.15 lib/basketball/org/player.rb
basketball-0.0.14 lib/basketball/org/player.rb
basketball-0.0.13 lib/basketball/org/player.rb
basketball-0.0.12 lib/basketball/org/player.rb
basketball-0.0.11 lib/basketball/org/player.rb
basketball-0.0.10 lib/basketball/org/player.rb
basketball-0.0.9 lib/basketball/org/player.rb