Module: Troles::Common::Operations::Read
- Included in:
- Troles::Common::Operations
- Defined in:
- lib/troles/common/operations/read.rb
Instance Method Summary collapse
-
#has?(*roles) ⇒ true, false
Test if the role subject has exactly the given roles.
-
#list ⇒ Array<Symbol>
The roles list of the role subject.
-
#used(*roles) ⇒ Object
Which of the given roles are used by the role subject Usage: - user.roles.used(:admin, :editor).include? :editor.
Instance Method Details
#has?(*roles) ⇒ true, false
Test if the role subject has exactly the given roles
13 14 15 |
# File 'lib/troles/common/operations/read.rb', line 13 def has? *roles list == roles.to_symbols_uniq end |
#list ⇒ Array<Symbol>
The roles list of the role subject
6 7 8 |
# File 'lib/troles/common/operations/read.rb', line 6 def list role_subject.role_list end |
#used(*roles) ⇒ Object
Which of the given roles are used by the role subject Usage:
- user.roles.used(:admin, :editor).include? :editor
23 24 25 |
# File 'lib/troles/common/operations/read.rb', line 23 def used *roles list & roles.to_symbols_uniq end |