config_default 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/Gemfile.lock +2 -2
- data/README.md +1 -1
- data/lib/config_default/rails_monkey_patch.rb +14 -0
- data/lib/config_default/version.rb +1 -1
- data/lib/config_default.rb +3 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8986cd898691eacd74aec36524a3eacd38433629b6ba8e71638619b33dd9f817
|
4
|
+
data.tar.gz: 87e0031a77052c3f9e42b87a2c670874cca926a6e1d0803c0c9c113d717f441f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f86e0e505bea0492833852ef4957c73ed8b3ab1b1f43e81e114cce90923fe737fb457ddf0259c5234a079b5458e6b1a6325c4dd560d2ad9c64526c63894bb432
|
7
|
+
data.tar.gz: 68a825fe3fd12616f413d28a20b712b9d8783d18bbc3b88615999502581fcbb58a3f74b714149c7d07ea627a8f721f9f8ff4ade4026a7fe7cf8eed7a7ef1800f
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -106,7 +106,7 @@ config = ConfigDefault.load(:app, key: "preprod") # Will search preprod key in f
|
|
106
106
|
|
107
107
|
### Struct using
|
108
108
|
|
109
|
-
If you want to use configuration as
|
109
|
+
If you want to use configuration as a struct object you can use `#load_struct` method.
|
110
110
|
Let's see an example with `database.yaml` config above:
|
111
111
|
|
112
112
|
```ruby
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConfigDefault::RailsMonkeyPatch
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def call
|
7
|
+
return unless Object.const_defined?("Rails")
|
8
|
+
return unless Object.const_defined?("Rails::Application")
|
9
|
+
return unless Object.const_defined?("Rails::Application::Configuration")
|
10
|
+
|
11
|
+
require "config_default/rails/application_extension"
|
12
|
+
require "config_default/rails/application/configuration_extension"
|
13
|
+
end
|
14
|
+
end
|
data/lib/config_default.rb
CHANGED
@@ -5,9 +5,7 @@ require "active_support/core_ext/hash"
|
|
5
5
|
require "config_default/version"
|
6
6
|
require "config_default/config"
|
7
7
|
require "config_default/struct"
|
8
|
-
|
9
|
-
require "config_default/rails/application/configuration_extension"
|
10
|
-
require "config_default/rails/application_extension"
|
8
|
+
require "config_default/rails_monkey_patch"
|
11
9
|
|
12
10
|
module ConfigDefault
|
13
11
|
extend self
|
@@ -48,3 +46,5 @@ module ConfigDefault
|
|
48
46
|
ConfigDefault::Struct.new(attributes, recursive: recursive, allow_nil: allow_nil)
|
49
47
|
end
|
50
48
|
end
|
49
|
+
|
50
|
+
ConfigDefault::RailsMonkeyPatch.call
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: config_default
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stepan Kirushkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- lib/config_default/config.rb
|
56
56
|
- lib/config_default/rails/application/configuration_extension.rb
|
57
57
|
- lib/config_default/rails/application_extension.rb
|
58
|
+
- lib/config_default/rails_monkey_patch.rb
|
58
59
|
- lib/config_default/struct.rb
|
59
60
|
- lib/config_default/version.rb
|
60
61
|
homepage: https://github.com/skirushkin/config_default
|