Required Files
- rubygems
- main
- yaml
Methods
Public Instance methods
[ show source ]
# File bin/pool, line 21
21: def init_pool
22: @pool = Tournament::Pool.ncaa_2008
23: @pool.bracket.scoring_strategy = Tournament::Bracket.strategy_for_name(params['scoring'].value)
24: end
Loads the pool from the save file. If the save file does not exist, creates a default pool
[ show source ]
# File bin/pool, line 13
13: def load_pool
14: @pool = YAML::load_file(save_file_name)
15: end
[ show source ]
# File bin/pool, line 84
84: def run
85: load_pool
86: @pool.entry_fee = params['amount'].value
87: save_pool
88: end
[ show source ]
# File bin/pool, line 189
189: def run
190: print usage.to_s
191: exit_warn!
192: end
[ show source ]
# File bin/pool, line 52
52: def run
53: init_pool
54: puts "Initialized new pool"
55: puts "Scoring:"
56: puts @pool.bracket.scoring_strategy.description
57: save_pool
58: end
[ show source ]
# File bin/pool, line 69
69: def run
70: load_pool
71: tournament = YAML::load_file(params['entry'].value)
72: @pool.bracket = tournament.picks
73: save_pool
74: end
[ show source ]
# File bin/pool, line 183
183: def run
184: load_pool
185: @pool.send("#{params['type'].value}_report")
186: end
[ show source ]
# File bin/pool, line 160
160: def run
161: load_pool
162: tournament = Tournament::Entry.new('Tournament', @pool.bracket, 0)
163: File.open(params['entry'].value, "w") do |f|
164: YAML::dump(tournament, f)
165: end
166: end
[ show source ]
# File bin/pool, line 137
137: def run
138: load_pool
139: if params['add'].given?
140: @pool.add_entry_yaml(params['add'].value)
141: save_pool
142: elsif params['remove'].given?
143: @pool.remove_by_name(params['remove'].value)
144: save_pool
145: else
146: puts "Please specify add or remove"
147: print usage.to_s
148: exit_warn!
149: end
150: end
[ show source ]
# File bin/pool, line 109
109: def run
110: load_pool
111: rank = params['rank'].value
112: if 'last' == rank
113: rank = :last
114: else
115: rank = rank.to_i
116: end
117: amount = params['amount'].value
118: amount = -amount if params['constant-amount'].value
119: @pool.set_payout(rank, amount)
120: save_pool
121: end
[ show source ]
# File bin/pool, line 17
17: def save_file_name
18: params['save-file'].value
19: end
[ show source ]
# File bin/pool, line 26
26: def save_pool
27: if @pool
28: File.open(save_file_name, "w") do |f|
29: YAML::dump(@pool, f)
30: end
31: end
32: end