summaryrefslogtreecommitdiff
path: root/app/models/tournament.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/tournament.rb')
-rw-r--r--app/models/tournament.rb22
1 files changed, 15 insertions, 7 deletions
diff --git a/app/models/tournament.rb b/app/models/tournament.rb
index 3e85744..67f994d 100644
--- a/app/models/tournament.rb
+++ b/app/models/tournament.rb
@@ -46,13 +46,21 @@ class Tournament < ActiveRecord::Base
end
end
- def get_type(val) {
- return vartypes[:true_false] if val == "true" or val == "false"
- return vartypes[:range] if /\d+-\d+/ =~ val
- return vartypes[:integer] if /\d+/ =~ val
- return vartypes[:select] if /,/ =~ val
- return vartypes[:string]
- }
+ def get_type(val)
+ case val
+ when "true", "false"
+ vartypes[:true_false]
+ when /\d+-\d/ =~ val
+ vartypes[:range]
+ when /\d+/ =~ val
+ vartypes[:integer]
+ when /,/ =~ val
+ vartypes[:select]
+ else
+ vartypes[:string]
+ end
+ end
+
def keys
@tournament.preferences_raw.all.collect { |x| x.name }