Class: Basketball::Draft::Event

Inherits:
Entity
  • Object
show all
Defined in:
lib/basketball/draft/event.rb

Overview

Describes what all Room events have to have to be considered an “event”.

Direct Known Subclasses

Pick, Skip

Instance Attribute Summary collapse

Attributes inherited from Entity

#id

Instance Method Summary collapse

Methods inherited from Entity

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

Constructor Details

#initialize(id:, front_office:, round:, round_pick:) ⇒ Event

Returns a new instance of Event.

Raises:

  • (ArgumentError)


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

def initialize(id:, front_office:, round:, round_pick:)
  super(id)

  raise ArgumentError, 'front_office required' unless front_office

  @front_office = front_office
  @round        = round.to_i
  @round_pick   = round_pick.to_i
end

Instance Attribute Details

#front_officeObject (readonly)

Returns the value of attribute front_office.



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

def front_office
  @front_office
end

#roundObject (readonly)

Returns the value of attribute round.



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

def round
  @round
end

#round_pickObject (readonly)

Returns the value of attribute round_pick.



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

def round_pick
  @round_pick
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/basketball/draft/event.rb', line 19

def to_s
  "[#{id}] R:#{round} P:#{round_pick} - #{front_office}"
end