Class: PermissionSettings::Configuration
- Inherits:
-
Object
- Object
- PermissionSettings::Configuration
- Defined in:
- lib/permission_settings/configuration.rb
Defined Under Namespace
Classes: PermissionsDirNotFound
Constant Summary collapse
- DEFAULT_PERMISSION_FILE_PATH =
'config/permissions'
- DEFAULT_ROLE_ACCESS_METHOD =
:role
Instance Attribute Summary collapse
-
#permissions_dir_path ⇒ Object
Returns the value of attribute permissions_dir_path.
-
#role_access_method ⇒ Object
Returns the value of attribute role_access_method.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #load_permissions_file(klass) ⇒ Object
- #permission_file_path(klass) ⇒ Object
- #scope_name(klass) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 |
# File 'lib/permission_settings/configuration.rb', line 14 def initialize @permissions_dir_path = DEFAULT_PERMISSION_FILE_PATH @role_access_method = DEFAULT_ROLE_ACCESS_METHOD end |
Instance Attribute Details
#permissions_dir_path ⇒ Object
Returns the value of attribute permissions_dir_path.
12 13 14 |
# File 'lib/permission_settings/configuration.rb', line 12 def @permissions_dir_path end |
#role_access_method ⇒ Object
Returns the value of attribute role_access_method.
12 13 14 |
# File 'lib/permission_settings/configuration.rb', line 12 def role_access_method @role_access_method end |
Instance Method Details
#load_permissions_file(klass) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/permission_settings/configuration.rb', line 23 def (klass) if RUBY_VERSION.to_f >= 3.1 YAML.load_file((klass), aliases: true) else YAML.load_file((klass)) end end |
#permission_file_path(klass) ⇒ Object
31 32 33 |
# File 'lib/permission_settings/configuration.rb', line 31 def (klass) File.join(, "#{klass.name.underscore}.yml") end |
#scope_name(klass) ⇒ Object
19 20 21 |
# File 'lib/permission_settings/configuration.rb', line 19 def scope_name(klass) [klass.name.underscore, 'permissions'].join('_').to_sym end |