discourse/lib/trust_level.rb

29 lines
458 B
Ruby
Raw Normal View History

2013-02-05 14:16:51 -05:00
class TrustLevel
attr_reader :id, :name
def self.Levels
{:new => 0,
:basic => 1,
:regular => 2,
:experienced => 3,
:advanced => 4,
:moderator => 5}
end
def self.all
self.Levels.map do |name_key, id|
TrustLevel.new(name_key, id)
end
end
def initialize(name_key, id)
2013-02-25 11:42:20 -05:00
@name = I18n.t("trust_levels.#{name_key}.title")
2013-02-05 14:16:51 -05:00
@id = id
end
def serializable_hash
{id: @id, name: @name}
end
end