Class: Etna::Permission
- Inherits:
-
Object
- Object
- Etna::Permission
- Defined in:
- lib/etna/permissions.rb
Constant Summary collapse
- ROLE_NAMES =
{ "A" => :admin, "E" => :editor, "V" => :viewer, "G" => :guest }
Instance Attribute Summary collapse
-
#project_name ⇒ Object
readonly
Returns the value of attribute project_name.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#role_key ⇒ Object
readonly
Returns the value of attribute role_key.
Instance Method Summary collapse
-
#initialize(role_key, project_name) ⇒ Permission
constructor
A new instance of Permission.
- #to_hash ⇒ Object
Constructor Details
#initialize(role_key, project_name) ⇒ Permission
Returns a new instance of Permission.
74 75 76 77 78 |
# File 'lib/etna/permissions.rb', line 74 def initialize(role_key, project_name) @role_key = role_key @role = Etna::Role.new(ROLE_NAMES[role_key.upcase], role_key == role_key.upcase) @project_name = project_name end |
Instance Attribute Details
#project_name ⇒ Object (readonly)
Returns the value of attribute project_name.
65 66 67 |
# File 'lib/etna/permissions.rb', line 65 def project_name @project_name end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
65 66 67 |
# File 'lib/etna/permissions.rb', line 65 def role @role end |
#role_key ⇒ Object (readonly)
Returns the value of attribute role_key.
65 66 67 |
# File 'lib/etna/permissions.rb', line 65 def role_key @role_key end |
Instance Method Details
#to_hash ⇒ Object
80 81 82 |
# File 'lib/etna/permissions.rb', line 80 def to_hash role.to_hash end |