Class: Sunrise::Models::RoleType

Inherits:
Object
  • Object
show all
Includes:
EnumField::DefineEnum
Defined in:
lib/sunrise/models/role_type.rb

Direct Known Subclasses

RoleType

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ RoleType

Returns a new instance of RoleType.



10
11
12
# File 'lib/sunrise/models/role_type.rb', line 10

def initialize(code)
  @code = code.to_sym
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



8
9
10
# File 'lib/sunrise/models/role_type.rb', line 8

def code
  @code
end

Class Method Details

.legal?(value) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/sunrise/models/role_type.rb', line 18

def self.legal?(value)
  all.map(&:id).include?(value)
end

Instance Method Details

#titleObject



14
15
16
# File 'lib/sunrise/models/role_type.rb', line 14

def title
  I18n.t(@code, scope: [:manage, :role, :kind])
end