basketball 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/basketball/draft/event.rb +4 -5
- data/lib/basketball/draft/pick.rb +2 -2
- data/lib/basketball/draft/room.rb +4 -4
- data/lib/basketball/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd49f58b9f207574c1d2d24dfbfbcc95aa19aa1b20dfef193e7ed5f76dc9c40b
|
4
|
+
data.tar.gz: 27b5646e17b6e4e195938b6df2c5aa72afa5cd8d83c19abe9cbbe52d603b6399
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09133208c27fa5edf1667a669178703ce702a3b9f20a2d0bb5006dc4ba3260b9b9ccd51db7bbc53cf61d2df12806fd0241ca6cb8ede153ca3af2782c30eeddf9'
|
7
|
+
data.tar.gz: 1e82cd3b7057c8e2ce63a1df77a4ecd4ea7ab8c64275db9d70c1e40d2f006b9b1e128d2a92311b3f3c3f99e35d5507f81ad8c5faec385906814ea53d32ce6583
|
@@ -4,21 +4,20 @@ module Basketball
|
|
4
4
|
module Draft
|
5
5
|
# Describes what all Room events have to have to be considered an "event".
|
6
6
|
class Event < Entity
|
7
|
-
attr_reader :
|
7
|
+
attr_reader :round, :round_pick, :front_office
|
8
8
|
|
9
|
-
def initialize(
|
10
|
-
super()
|
9
|
+
def initialize(id:, front_office:, round:, round_pick:)
|
10
|
+
super(id)
|
11
11
|
|
12
12
|
raise ArgumentError, 'front_office required' unless front_office
|
13
13
|
|
14
14
|
@front_office = front_office
|
15
|
-
@pick = pick.to_i
|
16
15
|
@round = round.to_i
|
17
16
|
@round_pick = round_pick.to_i
|
18
17
|
end
|
19
18
|
|
20
19
|
def to_s
|
21
|
-
"[#{id}]
|
20
|
+
"[#{id}] R:#{round} P:#{round_pick} - #{front_office}"
|
22
21
|
end
|
23
22
|
end
|
24
23
|
end
|
@@ -6,8 +6,8 @@ module Basketball
|
|
6
6
|
class Pick < Event
|
7
7
|
attr_reader :player, :auto
|
8
8
|
|
9
|
-
def initialize(front_office:, player:,
|
10
|
-
super(
|
9
|
+
def initialize(id:, front_office:, player:, round:, round_pick:, auto: false)
|
10
|
+
super(id:, front_office:, round:, round_pick:)
|
11
11
|
|
12
12
|
raise ArgumentError, 'player required' unless player
|
13
13
|
|
@@ -148,7 +148,7 @@ module Basketball
|
|
148
148
|
def skip!
|
149
149
|
return if done?
|
150
150
|
|
151
|
-
event = Skip.new(
|
151
|
+
event = Skip.new(id: pick, front_office:, round:, round_pick:)
|
152
152
|
|
153
153
|
add_event!(event)
|
154
154
|
|
@@ -159,7 +159,7 @@ module Basketball
|
|
159
159
|
return if done?
|
160
160
|
|
161
161
|
player = front_office.pick(assessment)
|
162
|
-
event = Pick.new(
|
162
|
+
event = Pick.new(id: pick, front_office:, round:, round_pick:, player:, auto: true)
|
163
163
|
|
164
164
|
add_event!(event)
|
165
165
|
|
@@ -183,7 +183,7 @@ module Basketball
|
|
183
183
|
def pick!(player)
|
184
184
|
return nil if done?
|
185
185
|
|
186
|
-
event = Pick.new(
|
186
|
+
event = Pick.new(id: pick, front_office:, round:, round_pick:, player:)
|
187
187
|
|
188
188
|
add_event!(event)
|
189
189
|
end
|
@@ -199,7 +199,7 @@ module Basketball
|
|
199
199
|
raise EndOfDraftError, "#{total_picks} pick limit reached" if done?
|
200
200
|
raise UnknownFrontOfficeError, "#{front_office} doesnt exist" unless front_offices.include?(event.front_office)
|
201
201
|
raise EventOutOfOrderError, "#{event.front_office} cant pick right now" if event.front_office != front_office
|
202
|
-
raise EventOutOfOrderError, "#{event} has wrong pick" if event.
|
202
|
+
raise EventOutOfOrderError, "#{event} has wrong pick" if event.id != pick
|
203
203
|
raise EventOutOfOrderError, "#{event} has wrong round" if event.round != round
|
204
204
|
raise EventOutOfOrderError, "#{event} has wrong round_pick" if event.round_pick != round_pick
|
205
205
|
|
data/lib/basketball/version.rb
CHANGED