Class: Basketball::Draft::Pick

Inherits:
Event show all
Defined in:
lib/basketball/draft/pick.rb

Overview

Room event where a player is selected.

Instance Attribute Summary collapse

Attributes inherited from Event

#front_office, #round, #round_pick

Attributes inherited from Entity

#id

Instance Method Summary collapse

Methods inherited from Entity

#<=>, #==, #comparable_id, #hash

Constructor Details

#initialize(id:, front_office:, player:, round:, round_pick:, auto: false) ⇒ Pick

Returns a new instance of Pick.

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
# File 'lib/basketball/draft/pick.rb', line 9

def initialize(id:, front_office:, player:, round:, round_pick:, auto: false)
  super(id:, front_office:, round:, round_pick:)

  raise ArgumentError, 'player required' unless player

  @player = player
  @auto   = auto
end

Instance Attribute Details

#autoObject (readonly)

Returns the value of attribute auto.



7
8
9
# File 'lib/basketball/draft/pick.rb', line 7

def auto
  @auto
end

#playerObject (readonly)

Returns the value of attribute player.



7
8
9
# File 'lib/basketball/draft/pick.rb', line 7

def player
  @player
end

Instance Method Details

#to_sObject



18
19
20
# File 'lib/basketball/draft/pick.rb', line 18

def to_s
  "#{super} #{auto ? 'auto-' : ''}picked #{player}"
end