Class: Global::Backend::Filesystem
- Inherits:
-
Object
- Object
- Global::Backend::Filesystem
- Defined in:
- lib/global/backend/filesystem.rb
Overview
Loads Global configuration from the filesystem
Available options:
-
‘path` (required): the directory with config files
-
‘environment` (required): the environment to load
-
‘yaml_whitelist_classes`: the set of classes that are permitted to unmarshal from the configuration files
For Rails:
-
the ‘path` is optional and defaults to `config/global`
-
the ‘environment` is optional and defaults to the current Rails environment
Constant Summary collapse
- FILE_ENV_SPLIT =
'.'
- YAML_EXT =
'.yml'
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Filesystem
constructor
A new instance of Filesystem.
- #load ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Filesystem
Returns a new instance of Filesystem.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/global/backend/filesystem.rb', line 20 def initialize( = {}) if defined?(Rails) @path = .fetch(:path) { Rails.root.join('config', 'global').to_s } @environment = .fetch(:environment) { Rails.env.to_s } else @path = .fetch(:path) @environment = .fetch(:environment) end @yaml_whitelist_classes = .fetch(:yaml_whitelist_classes, []) end |
Instance Method Details
#load ⇒ Object
31 32 33 |
# File 'lib/global/backend/filesystem.rb', line 31 def load load_from_path(@path) end |