Class: Etna::Role
- Inherits:
-
Object
- Object
- Etna::Role
- Defined in:
- lib/etna/permissions.rb
Instance Attribute Summary collapse
-
#restricted ⇒ Object
readonly
Returns the value of attribute restricted.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
Instance Method Summary collapse
-
#initialize(role, restricted) ⇒ Role
constructor
A new instance of Role.
- #key ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(role, restricted) ⇒ Role
Returns a new instance of Role.
87 88 89 90 |
# File 'lib/etna/permissions.rb', line 87 def initialize(role, restricted) @role = role @restricted = restricted end |
Instance Attribute Details
#restricted ⇒ Object (readonly)
Returns the value of attribute restricted.
86 87 88 |
# File 'lib/etna/permissions.rb', line 86 def restricted @restricted end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
86 87 88 |
# File 'lib/etna/permissions.rb', line 86 def role @role end |
Instance Method Details
#key ⇒ Object
92 93 94 95 |
# File 'lib/etna/permissions.rb', line 92 def key role_key = role.to_s[0] restricted ? role_key.upcase : role_key end |
#to_hash ⇒ Object
97 98 99 100 101 102 |
# File 'lib/etna/permissions.rb', line 97 def to_hash { role: role, restricted: restricted, } end |