Sha256: 6043ee15fa058036d154a2fb878a1d7f18cf2ef56805a6dd018e2d845a0984e8

Contents?: true

Size: 457 Bytes

Versions: 12

Compression:

Stored size: 457 Bytes

Contents

# frozen_string_literal: true

module Basketball
  module Org
    # Helper methods for objects that can be composed of players.
    module HasPlayers
      def player?(player)
        players.include?(player)
      end

      private

      def assert_players_are_not_already_signed(players)
        players.each do |player|
          raise PlayerAlreadySignedError, "#{player} already registered" if player?(player)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
basketball-0.0.22 lib/basketball/org/has_players.rb
basketball-0.0.21 lib/basketball/org/has_players.rb
basketball-0.0.20 lib/basketball/org/has_players.rb
basketball-0.0.19 lib/basketball/org/has_players.rb
basketball-0.0.18 lib/basketball/org/has_players.rb
basketball-0.0.17 lib/basketball/org/has_players.rb
basketball-0.0.16 lib/basketball/org/has_players.rb
basketball-0.0.15 lib/basketball/org/has_players.rb
basketball-0.0.14 lib/basketball/org/has_players.rb
basketball-0.0.13 lib/basketball/org/has_players.rb
basketball-0.0.12 lib/basketball/org/has_players.rb
basketball-0.0.11 lib/basketball/org/has_players.rb