Class: Formol::Permissions::Profile
- Inherits:
-
Object
- Object
- Formol::Permissions::Profile
- Defined in:
- lib/formol/permissions/profile.rb
Instance Attribute Summary collapse
-
#rights ⇒ Object
readonly
Returns the value of attribute rights.
Instance Method Summary collapse
- #<<(right) ⇒ Object
- #delete(right) ⇒ Object
- #has_right?(right) ⇒ Boolean
-
#initialize(name, rights = []) ⇒ Profile
constructor
A new instance of Profile.
Constructor Details
#initialize(name, rights = []) ⇒ Profile
Returns a new instance of Profile.
6 7 8 9 |
# File 'lib/formol/permissions/profile.rb', line 6 def initialize(name, rights = []) @name = name.to_sym @rights = rights.collect(&:to_sym) end |
Instance Attribute Details
#rights ⇒ Object (readonly)
Returns the value of attribute rights.
4 5 6 |
# File 'lib/formol/permissions/profile.rb', line 4 def rights @rights end |
Instance Method Details
#<<(right) ⇒ Object
15 16 17 |
# File 'lib/formol/permissions/profile.rb', line 15 def <<(right) @rights << right.to_sym end |
#delete(right) ⇒ Object
19 20 21 |
# File 'lib/formol/permissions/profile.rb', line 19 def delete(right) @rights.delete(right.to_sym) end |
#has_right?(right) ⇒ Boolean
11 12 13 |
# File 'lib/formol/permissions/profile.rb', line 11 def has_right?(right) @rights.include?(right.to_sym) end |