Class: Sunrise::Models::RoleType
- Inherits:
-
Object
- Object
- Sunrise::Models::RoleType
- Includes:
- EnumField::DefineEnum
- Defined in:
- lib/sunrise/models/role_type.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code) ⇒ RoleType
constructor
A new instance of RoleType.
- #title ⇒ Object
Constructor Details
#initialize(code) ⇒ RoleType
Returns a new instance of RoleType.
9 10 11 |
# File 'lib/sunrise/models/role_type.rb', line 9 def initialize(code) @code = code.to_sym end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
7 8 9 |
# File 'lib/sunrise/models/role_type.rb', line 7 def code @code end |
Class Method Details
.legal?(value) ⇒ Boolean
17 18 19 |
# File 'lib/sunrise/models/role_type.rb', line 17 def self.legal?(value) all.map(&:id).include?(value) end |
Instance Method Details
#title ⇒ Object
13 14 15 |
# File 'lib/sunrise/models/role_type.rb', line 13 def title I18n.t(@code, :scope => [:manage, :role, :kind]) end |