prep for renaming trust level levels

This commit is contained in:
Sam 2014-09-05 08:42:18 +10:00
parent 1ddedc6ed7
commit c8d3ffb1ee
1 changed files with 9 additions and 0 deletions

View File

@ -1,9 +1,18 @@
require_dependency 'enum'
class InvalidTrustLevel < StandardError; end
class TrustLevel
attr_reader :id, :name
class << self
def[](val)
if val < 0 || val > 4
raise InvalidTrustLevel
end
val
end
def levels
@levels ||= Enum.new(
:newuser, :basic, :regular, :leader, :elder, start: 0