Class: Localer::Config
- Inherits:
-
Object
- Object
- Localer::Config
- Extended by:
- Dry::Initializer
- Defined in:
- lib/localer/config.rb,
lib/localer/config/locale.rb
Overview
Loads and parse Localer config file ‘.localer.yml`
Defined Under Namespace
Classes: Locale
Constant Summary collapse
- APP_PATH =
Dir.pwd
- CONFIG_FILENAME =
".localer.yml"
Class Method Summary collapse
Class Method Details
.file_config(filename, path) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/localer/config.rb', line 29 def file_config(filename, path) filename = File.(filename, path) return {} unless File.exist?(filename) return {} if File.zero?(filename) YAML .load_file(filename) .deep_downcase_keys .deep_symbolize_keys end |
.load(options = {}) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/localer/config.rb', line 22 def load( = {}) opts = .deep_symbolize_keys app_path = opts.fetch(:app_path, APP_PATH) = file_config(CONFIG_FILENAME, app_path) new(.deep_merge(opts).deep_symbolize_keys) end |