diff options
author | AndrewMurrell <amurrel@purdue.edu> | 2014-04-26 21:05:46 -0400 |
---|---|---|
committer | AndrewMurrell <amurrel@purdue.edu> | 2014-04-26 21:05:46 -0400 |
commit | a9a59bf0199c761ada889f23274aa0a56da50554 (patch) | |
tree | f7699c5d2c851bee1e56db1c4ec6e5a41686d15f /app/models | |
parent | edcca83c6c251a79afcd83760cf20ebaf00b3b32 (diff) |
lib methods for tournament_stage
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/tournament_stage.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/models/tournament_stage.rb b/app/models/tournament_stage.rb index 9352137..84519b9 100644 --- a/app/models/tournament_stage.rb +++ b/app/models/tournament_stage.rb @@ -25,6 +25,29 @@ class TournamentStage < ActiveRecord::Base return seeding.seed.pair(matches, players) end + def make_methods(dir) + if @methods[dir].nil? or Rails.env.development? + @methods[dir] = Dir.glob("#{Rails.root}/lib/#{dir}/*.rb").map{|filename| filename.sub(/.*\/(.*)\.rb/, /\1/)} + end + return @methods[dir] + end + + def scoring_methods + make_methods "scoring" + end + + def sampling_methods + make_methods "sampling" + end + + def scheduling_methods + make_methods "scheduling" + end + + def seeding_methods + make_methods "seeding" + end + # Accessors to the configured methods def scoring |