Class: Anyway::Loaders::YAML

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

Direct Known Subclasses

Rails::Loaders::YAML

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

Instance Method Details

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



12
13
14
15
16
17
18
19
20
21
# File 'lib/anyway/loaders/yaml.rb', line 12

def call(config_path:, **_options)
  base_config = trace!(:yml, path: relative_config_path(config_path).to_s) { load_base_yml(config_path) }

  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) }

  base_config.deep_merge!(local_config)
end