module TroleGroups::Operations::Read

Public Instance Methods

has?(*rolegroups) click to toggle source

Test if the role subject has exactly the given roles @param [Array<Symbol>] role list to test @return [true, false] true if role subject has exactly those roles, false otherwise

# File lib/trole_groups/operations/read.rb, line 21
def has? *rolegroups
  list == rolegroups.to_symbols_uniq
end
list() click to toggle source

The roles list of the role subject @return [Array<Symbol>] the list of roles

# File lib/trole_groups/operations/read.rb, line 14
def list
  rolegroup_subject.rolegroup_list
end
roles() click to toggle source
# File lib/trole_groups/operations/read.rb, line 4
def roles
  
end
roles_for(*names) click to toggle source
# File lib/trole_groups/operations/read.rb, line 8
def roles_for *names
  rolegroup_subject.roles_for *names
end
used(*rolegroups) click to toggle source

Which of the given roles are used by the role subject @param [Array<Symbol>] roles to test for inclusion

Usage:

- user.roles.used(:admin, :editor).include? :editor
# File lib/trole_groups/operations/read.rb, line 31
def used *rolegroups
  list & rolegroups.to_symbols_uniq
end