Module: Shamu::Security::Roles
Overview
Class Method Summary collapse
-
.expand_roles(*roles) ⇒ Array<Symbol>
Expand the given roles to include the roles that they have inherited.
-
.role(name, inherits: nil)
Define a named role.
-
.role_defined?(role) ⇒ Boolean
True if the role has been defined.
-
.roles ⇒ Hash
The named roles defined on the class.
Class Method Details
.expand_roles(*roles) ⇒ Array<Symbol>
Expand the given roles to include the roles that they have inherited.
29 30 31 |
# File 'lib/shamu/security/roles.rb', line 29 def ( *roles ) ( roles, Set.new ).to_a end |
.role(name, inherits: nil)
This method returns an undefined value.
Define a named role.
22 23 24 |
# File 'lib/shamu/security/roles.rb', line 22 def role( name, inherits: nil ) roles[ name.to_sym ] = { inherits: Array( inherits ) } end |
.role_defined?(role) ⇒ Boolean
Returns true if the role has been defined.
35 36 37 |
# File 'lib/shamu/security/roles.rb', line 35 def role_defined?( role ) roles.key?( role.to_sym ) end |
.roles ⇒ Hash
Returns the named roles defined on the class.
12 13 14 |
# File 'lib/shamu/security/roles.rb', line 12 def roles @roles ||= {} end |