ravioli 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db780ea4e1fbb555cd42fd3c40f9102a18459a35d917cc214c998372b9599425
4
- data.tar.gz: f4f7aa3bcd938fc48127be91f686263019e64728530e0591f687f465f2c63384
3
+ metadata.gz: 18e8f375f4680381f076c2cf30da628ad3eff949809c91bb5bdd8cbd497c5360
4
+ data.tar.gz: 7efd3e86edff327df47caad0be5e107ea0d9bdf1a79ff61ff55e5868389286c5
5
5
  SHA512:
6
- metadata.gz: 2f6ddf167319edf2337b0f52d4bcf3211c7aaa5062404b834245ac31b0e1e1311ef45a992149b77c04050d6c4d94152d4556cab2f708f4f3706044725a4c2b0d
7
- data.tar.gz: d9a6c2ea272073e80182318d8c112ea1a57f44ad85e352e560495c6a216a0f515bdc675c6f0e3a2f54a3a482177316b434989bfa3b191d4e7746186244eb4e67
6
+ metadata.gz: 10c5a53c1b2cb4bf44f5d0a633f2baab987a63d03154b3e154366652fd633575686c652e4b07fc82fa46dbc8e636a917a34f2e0f6717e669b922885ff11d07ea
7
+ data.tar.gz: bccc5db611656b946d46fd42439b360b2a4ddb1f6b3eef710c08ebf9689d7474bd62d4725bf40ddc5ae175c776160557ae4170e9fac0be69c5ffc14506b3c241
@@ -140,8 +140,8 @@ module Ravioli
140
140
  end
141
141
 
142
142
  # Load a file either with a given path or by name (e.g. `config/whatever.yml` or `:whatever`)
143
- def load_file(path, options = {})
144
- config = parse_config_file(path, options)
143
+ def load_file(path, **options)
144
+ config = parse_config_file(path, **options)
145
145
  configuration.append(config) if config.present?
146
146
  rescue => error
147
147
  warn "Could not load config file #{path}", error
@@ -221,10 +221,9 @@ module Ravioli
221
221
  # rubocop:enable Style/MissingRespondToMissing
222
222
  # rubocop:enable Style/MethodMissingSuper
223
223
 
224
- def parse_config_file(path, options = {})
224
+ def parse_config_file(path, **options)
225
225
  # Stash a reference to the file we're parsing, so we can reload it later if it tries to use
226
226
  # the configuration object
227
- @current_path = path
228
227
  path = path_to_config_file_path(path)
229
228
 
230
229
  config = case path.extname.downcase
@@ -286,7 +285,7 @@ module Ravioli
286
285
  def parse_yaml_config_file(path)
287
286
  contents = File.read(path)
288
287
  erb = ERB.new(contents).tap { |renderer| renderer.filename = path.to_s }
289
- YAML.safe_load(erb.result, [Symbol], aliases: true)
288
+ YAML.safe_load(erb.result, permitted_classes: [Symbol], aliases: true)
290
289
  end
291
290
 
292
291
  def path_to_config_file_path(path, extnames: EXTNAMES, quiet: false)
@@ -67,7 +67,9 @@ module Ravioli
67
67
  def cast(key, value)
68
68
  if value.is_a?(Hash)
69
69
  original_value = dig(*Array(key))
70
- value = original_value.table.deep_merge(value.deep_symbolize_keys) if original_value.is_a?(self.class)
70
+ transform = ->(value) { value.is_a?(self.class) ? value.table.deep_transform_values(&transform) : value }
71
+ original_value = original_value.table.deep_transform_values(&transform) if original_value.is_a?(self.class)
72
+ value = original_value.deep_merge(value.deep_symbolize_keys) if original_value.is_a?(Hash)
71
73
  build(key, value)
72
74
  else
73
75
  fetch_env_key_for(key) {
@@ -89,7 +91,6 @@ module Ravioli
89
91
  Array(key_path) + Array(keys)
90
92
  end
91
93
 
92
- # rubocop:disable Style/MethodMissingSuper
93
94
  # rubocop:disable Style/MissingRespondToMissing
94
95
  def method_missing(method, *args, &block)
95
96
  return super unless args.empty?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ravioli
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ravioli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flip Sasser
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-20 00:00:00.000000000 Z
11
+ date: 2022-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport