Module: Checken::Concerns::HasParents
- Included in:
- Permission, PermissionGroup
- Defined in:
- lib/checken/concerns/has_parents.rb
Instance Method Summary collapse
-
#parents ⇒ Array<Checken::PermissionGroup, Checken::Permission>
Return the parents for ths group.
-
#path ⇒ String
Return the full path to this permission.
-
#path_with_namespace ⇒ String
Return the full path to this permission with the namespace.
-
#root ⇒ Checken::PermissionGroup
Return the root group.
Instance Method Details
#parents ⇒ Array<Checken::PermissionGroup, Checken::Permission>
Return the parents for ths group
22 23 24 |
# File 'lib/checken/concerns/has_parents.rb', line 22 def parents @key.nil? ? [] : [@group.parents, @group].compact.flatten end |
#path ⇒ String
Return the full path to this permission
8 9 10 |
# File 'lib/checken/concerns/has_parents.rb', line 8 def path @key.nil? ? nil : [@group.path, @key].compact.join('.') end |
#path_with_namespace ⇒ String
Return the full path to this permission with the namespace
15 16 17 |
# File 'lib/checken/concerns/has_parents.rb', line 15 def path_with_namespace [@schema.config.namespace, path].compact.join(@schema.config.namespace_delimiter) end |
#root ⇒ Checken::PermissionGroup
Return the root group
29 30 31 |
# File 'lib/checken/concerns/has_parents.rb', line 29 def root @key.nil? ? self : parents.first end |