module Troles::Common::Operations::Read
Public Instance Methods
has?(*roles)
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/troles/common/operations/read.rb, line 13 def has? *roles list == roles.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/troles/common/operations/read.rb, line 6 def list role_subject.role_list end
used(*roles)
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/troles/common/operations/read.rb, line 23 def used *roles list & roles.to_symbols_uniq end