qonfig 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.travis.yml +1 -0
- data/CHANGELOG.md +4 -0
- data/LICENSE.txt +1 -1
- data/README.md +7 -0
- data/lib/qonfig/data_set/validator.rb +7 -0
- data/lib/qonfig/data_set.rb +9 -0
- data/lib/qonfig/settings.rb +22 -0
- data/lib/qonfig/version.rb +1 -1
- data/qonfig.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e73813f816c3ed07773bfd932c9d4d628688327326463d5d7a2755058acd49bc
|
4
|
+
data.tar.gz: 513fe5d381b2cbddddb6e5bc0f10f518b3cae24dce6f8689810600a22698396f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1855afada5513df5986bd45b2d4ce8d747f6389886763841ace0b4cd6a2f1b063c69feaff8075da4b803cee23cc335c3b4a6cfa434a328d1d9b43080e7b65b54
|
7
|
+
data.tar.gz: 7990a53bd25a8c6d0f78c8daff1453b4e14d2c9b380dde31e813499829d28f9667d8ae30e886a51ea5f8c5d2392d3bef9c23315afd7314a8c54bb008bac77ae1
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [0.10.0] - 2019-02-26
|
5
|
+
### Added
|
6
|
+
- `#slice_value` - get a slice of config options as a hash set and fetch the required value using the given key set;
|
7
|
+
|
4
8
|
## [0.9.0] - 2018-11-28
|
5
9
|
### Added
|
6
10
|
- `#slice` - get a slice of config options as a hash set (works in a `#dig` manner);
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -22,6 +22,7 @@ require 'qonfig'
|
|
22
22
|
## Usage
|
23
23
|
|
24
24
|
- [Definition and Settings Access](#definition-and-access)
|
25
|
+
- [Dynamic value calculation](???)
|
25
26
|
- [Configuration](#configuration)
|
26
27
|
- [Inheritance](#inheritance)
|
27
28
|
- [Composition](#composition)
|
@@ -98,6 +99,12 @@ config.slice(:vendor_api) # => { 'vendor_api' => { 'host' => 'app_service', 'use
|
|
98
99
|
config.slice(:vendor_api, :user) # => { 'user' => 'test_user' }
|
99
100
|
config.slice(:project_api) # => Qonfig::UnknownSettingError # (key does not exist)
|
100
101
|
config.slice(:vendor_api, :port) # => Qonfig::UnknownSettingError # (key does not exist)
|
102
|
+
|
103
|
+
# get value from the slice of setting options using the given key set (and fail when the required key does not exist) (works in slice manner)
|
104
|
+
config.slice_value(:vendor_api) # => { 'host' => 'app_service', 'user' => 'test_user' }
|
105
|
+
config.slice_value(:vendor_api, :user) # => 'test_user'
|
106
|
+
config.slice_value(:project_api) # => Qonfig::UnknownSettingError # (key does not exist)
|
107
|
+
config.slice_value(:vendor_api, :port) # => Qonfig::UnknownSettingError # (key does not exist)
|
101
108
|
```
|
102
109
|
|
103
110
|
---
|
data/lib/qonfig/data_set.rb
CHANGED
@@ -104,6 +104,15 @@ module Qonfig
|
|
104
104
|
thread_safe_access { settings.__slice__(*keys) }
|
105
105
|
end
|
106
106
|
|
107
|
+
# @param keys [Array<String, Symbol>]
|
108
|
+
# @return [Hash,Any]
|
109
|
+
#
|
110
|
+
# @api public
|
111
|
+
# @since 0.10.0
|
112
|
+
def slice_value(*keys)
|
113
|
+
thread_safe_access { settings.__slice_value__(*keys) }
|
114
|
+
end
|
115
|
+
|
107
116
|
# @return [void]
|
108
117
|
#
|
109
118
|
# @api public
|
data/lib/qonfig/settings.rb
CHANGED
@@ -103,6 +103,15 @@ module Qonfig
|
|
103
103
|
__lock__.thread_safe_access { __deep_slice__(*keys) }
|
104
104
|
end
|
105
105
|
|
106
|
+
# @param keys [Array<String, Symbol>]
|
107
|
+
# @return [Hash, Any]
|
108
|
+
#
|
109
|
+
# @api private
|
110
|
+
# @since 0.10.0
|
111
|
+
def __slice_value__(*keys)
|
112
|
+
__lock__.thread_safe_access { __deep_slice_value__(*keys) }
|
113
|
+
end
|
114
|
+
|
106
115
|
# @return [Hash]
|
107
116
|
#
|
108
117
|
# @api private
|
@@ -318,6 +327,19 @@ module Qonfig
|
|
318
327
|
end
|
319
328
|
end
|
320
329
|
|
330
|
+
# @param keys [Array<Symbol, String>]
|
331
|
+
# @return [Hash]
|
332
|
+
#
|
333
|
+
# @raise [Qonfig::ArgumentError]
|
334
|
+
# @raise [Qonfig::UnknownSettingError]
|
335
|
+
#
|
336
|
+
# @api private
|
337
|
+
# @since 0.1.0
|
338
|
+
def __deep_slice_value__(*keys)
|
339
|
+
required_key = __indifferently_accessable_option_key__(keys.last)
|
340
|
+
__deep_slice__(*keys)[required_key]
|
341
|
+
end
|
342
|
+
|
321
343
|
# @param options_part [Hash]
|
322
344
|
# @return [Hash]
|
323
345
|
#
|
data/lib/qonfig/version.rb
CHANGED
data/qonfig.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency 'coveralls', '~> 0.8'
|
32
32
|
spec.add_development_dependency 'simplecov', '~> 0.16'
|
33
33
|
spec.add_development_dependency 'rspec', '~> 3.8'
|
34
|
-
spec.add_development_dependency 'armitage-rubocop', '~> 0.
|
34
|
+
spec.add_development_dependency 'armitage-rubocop', '~> 0.21'
|
35
35
|
|
36
36
|
spec.add_development_dependency 'bundler'
|
37
37
|
spec.add_development_dependency 'rake'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qonfig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rustam Ibragimov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.21'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.21'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- lib/qonfig/configurable.rb
|
146
146
|
- lib/qonfig/data_set.rb
|
147
147
|
- lib/qonfig/data_set/class_builder.rb
|
148
|
+
- lib/qonfig/data_set/validator.rb
|
148
149
|
- lib/qonfig/dsl.rb
|
149
150
|
- lib/qonfig/error.rb
|
150
151
|
- lib/qonfig/loaders/basic.rb
|
@@ -179,8 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
180
|
- !ruby/object:Gem::Version
|
180
181
|
version: '0'
|
181
182
|
requirements: []
|
182
|
-
|
183
|
-
rubygems_version: 2.7.6
|
183
|
+
rubygems_version: 3.0.2
|
184
184
|
signing_key:
|
185
185
|
specification_version: 4
|
186
186
|
summary: Config object
|