Class: Tundengine::Stages::Tournament
- Defined in:
- lib/tundengine/stages/tournament.rb
Constant Summary collapse
- SETTINGS_KEYS =
%i(max_matches match_settings)
Instance Attribute Summary collapse
-
#players ⇒ Object
readonly
TODO: Add a setting to run matches on multiple threads.
-
#settings ⇒ Object
readonly
TODO: Add a setting to run matches on multiple threads.
Attributes inherited from Base
#child_in_play, #children, #parent
Instance Method Summary collapse
-
#initialize(players, settings) ⇒ Tournament
constructor
A new instance of Tournament.
- #on_complete_child!(result) ⇒ Object
- #summary ⇒ Object
Methods inherited from Base
#as_hash, #declare!, #fast_forward!, #lock!, #play!, #rewind!
Constructor Details
#initialize(players, settings) ⇒ Tournament
Returns a new instance of Tournament.
10 11 12 13 14 15 |
# File 'lib/tundengine/stages/tournament.rb', line 10 def initialize(players, settings) @players = players @settings = settings @result = initial_result super() end |
Instance Attribute Details
#players ⇒ Object (readonly)
TODO: Add a setting to run matches on multiple threads.
8 9 10 |
# File 'lib/tundengine/stages/tournament.rb', line 8 def players @players end |
#settings ⇒ Object (readonly)
TODO: Add a setting to run matches on multiple threads.
8 9 10 |
# File 'lib/tundengine/stages/tournament.rb', line 8 def settings @settings end |
Instance Method Details
#on_complete_child!(result) ⇒ Object
26 27 28 29 |
# File 'lib/tundengine/stages/tournament.rb', line 26 def on_complete_child!(result) update_result!(result) super() end |
#summary ⇒ Object
31 32 33 34 35 36 |
# File 'lib/tundengine/stages/tournament.rb', line 31 def summary { players: players.map(&:name), result: @result.each_with_object({}) { |(k,v),h| h[k.to_s] = v } } end |