Class: Anyway::Loaders::YAML

Inherits:
Base
  • Object
show all
Defined in:
lib/anyway/loaders/yaml.rb

Direct Known Subclasses

Rails::Loaders::YAML

Constant Summary collapse

@@permitted_classes =
[]

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

call, #initialize, #use_local?

Methods included from Tracing

capture, current_trace, current_trace_source, source_stack, trace!, trace_stack, with_trace_source

Constructor Details

This class inherits a constructor from Anyway::Loaders::Base

Class Method Details

.permitted_classesObject



15
# File 'lib/anyway/loaders/yaml.rb', line 15

def permitted_classes = @@permitted_classes

Instance Method Details

#call(config_path:, **_options) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/anyway/loaders/yaml.rb', line 18

def call(config_path:, **_options)
  rel_config_path = relative_config_path(config_path).to_s
  base_config = trace!(:yml, path: rel_config_path) do
    config = load_base_yml(config_path)
    environmental?(config) ? config_with_env(config) : config
  end

  return base_config unless use_local?

  local_path = local_config_path(config_path)
  local_config = trace!(:yml, path: relative_config_path(local_path).to_s) { load_local_yml(local_path) }
  Utils.deep_merge!(base_config, local_config)
end