Module: TroleGroups::Operations::Read
- Included in:
- TroleGroups::Operations
- Defined in:
- lib/trole_groups/operations/read.rb
Instance Method Summary collapse
-
#has?(*rolegroups) ⇒ true, false
Test if the role subject has exactly the given roles.
-
#list ⇒ Array<Symbol>
The roles list of the role subject.
- #roles ⇒ Object
- #roles_for(*names) ⇒ Object
-
#used(*rolegroups) ⇒ Object
Which of the given roles are used by the role subject Usage: - user.roles.used(:admin, :editor).include? :editor.
Instance Method Details
#has?(*rolegroups) ⇒ true, false
Test if the role subject has exactly the given roles
21 22 23 |
# File 'lib/trole_groups/operations/read.rb', line 21 def has? *rolegroups list == rolegroups.to_symbols_uniq end |
#list ⇒ Array<Symbol>
The roles list of the role subject
14 15 16 |
# File 'lib/trole_groups/operations/read.rb', line 14 def list rolegroup_subject.rolegroup_list end |
#roles ⇒ Object
4 5 6 |
# File 'lib/trole_groups/operations/read.rb', line 4 def roles end |
#roles_for(*names) ⇒ Object
8 9 10 |
# File 'lib/trole_groups/operations/read.rb', line 8 def roles_for *names rolegroup_subject.roles_for *names end |
#used(*rolegroups) ⇒ Object
Which of the given roles are used by the role subject Usage:
- user.roles.used(:admin, :editor).include? :editor
31 32 33 |
# File 'lib/trole_groups/operations/read.rb', line 31 def used *rolegroups list & rolegroups.to_symbols_uniq end |