Class: CanI::AuthorizationRole
- Inherits:
-
Object
- Object
- CanI::AuthorizationRole
- Defined in:
- lib/can_i/authorization_role.rb
Class Method Summary collapse
-
.authorization_roles(&block) ⇒ Object
DSL to register a block to add more roles.
-
.class_instance_blocks ⇒ Object
Stores the blocks registered just for this class.
-
.registration_blocks ⇒ Object
Returns blocks for this subclass & all superclasses merged together.
Class Method Details
.authorization_roles(&block) ⇒ Object
DSL to register a block to add more roles
31 32 33 |
# File 'lib/can_i/authorization_role.rb', line 31 def (&block) class_instance_blocks << block end |
.class_instance_blocks ⇒ Object
Stores the blocks registered just for this class
41 42 43 |
# File 'lib/can_i/authorization_role.rb', line 41 def class_instance_blocks @class_instance_blocks ||= [] end |
.registration_blocks ⇒ Object
Returns blocks for this subclass & all superclasses merged together
36 37 38 |
# File 'lib/can_i/authorization_role.rb', line 36 def registration_blocks ancestors.select { |klass| klass <= CanI::AuthorizationRole }.map { |klass| klass.class_instance_blocks }.flatten end |