summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-26 21:12:06 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-26 21:12:06 -0400
commit2c1e5ab5e7b20dabec9ddb9b34e0cf534afc6d06 (patch)
treec47e8dbc1f4c80ef9bd4531fd7f0de3f0e30c9ca /app/models
parentedb9e6a59459b42acb8dc751044d51c70e81429c (diff)
parentf156d56096e08254a249304b68ae0cb433ef9db3 (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'app/models')
-rw-r--r--app/models/tournament_stage.rb23
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