deimos-ruby 1.4.0.pre.beta2 → 1.4.0.pre.beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/lib/deimos/config/configurable.rb +8 -2
- data/lib/deimos/config/configuration.rb +1 -1
- data/lib/deimos/version.rb +1 -1
- data/spec/config/configurable_spec.rb +4 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 755a361a8e3344715436d6a90e45f4d27ceab2eba219291b59055ca2e7afcc39
|
4
|
+
data.tar.gz: 8678c4ebad89bf1f58f82190af970f346360dc0a768b2adc075d80bad92dde0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22b5010a4d5b3f4cb6423237f13eb8081f232520749252ffa8c37df38516f7155e2a7f9b5d4d68ac3c9b948b7aee144201bffcc3488c6341c14fb97f6fee67a5
|
7
|
+
data.tar.gz: dad1196a141be2b076f4c0043f5ce9250b89bb115ae07cc07861c5b9085f1f58878e786a9235c107244fad0b933c2899fa93f23568a9d9ada9d95c7bdae12c86
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## UNRELEASED
|
9
9
|
|
10
|
+
# [1.4.0-beta3] - 2019-11-26
|
11
|
+
- Added `define_settings` to define settings without invoking callbacks.
|
12
|
+
|
10
13
|
# [1.4.0-beta2] - 2019-11-22
|
11
14
|
- FIX: settings with default_proc were being called immediately
|
12
15
|
instead of being lazy-evaluated.
|
data/Gemfile.lock
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
+
require 'active_support/callbacks'
|
4
5
|
|
5
6
|
module Deimos
|
6
7
|
# Module to allow configuration. Loosely based off of the dry-configuration
|
@@ -24,7 +25,7 @@ module Deimos
|
|
24
25
|
# end
|
25
26
|
# - Allows to call `configure` multiple times without crashing.
|
26
27
|
# - Allows to lazy-set default values by passing a proc as a default:
|
27
|
-
# Deimos.
|
28
|
+
# Deimos.define_settings do |config|
|
28
29
|
# setting :my_val, default_proc: proc { MyDefault.calculated_value }
|
29
30
|
# end
|
30
31
|
# - Support for setting up and automatically calling deprecated configurations.
|
@@ -237,7 +238,12 @@ module Deimos
|
|
237
238
|
|
238
239
|
# :nodoc:
|
239
240
|
module ClassMethods
|
240
|
-
#
|
241
|
+
# Define and redefine settings.
|
242
|
+
def define_settings(&block)
|
243
|
+
config.instance_eval(&block)
|
244
|
+
end
|
245
|
+
|
246
|
+
# Configure the settings with values.
|
241
247
|
def configure(&block)
|
242
248
|
config.run_callbacks(:configure) do
|
243
249
|
config.instance_eval(&block)
|
data/lib/deimos/version.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
class MyConfig
|
5
5
|
include Deimos::Configurable
|
6
6
|
|
7
|
-
|
7
|
+
define_settings do
|
8
8
|
setting :set1
|
9
9
|
setting :set2, 'hi mom'
|
10
10
|
setting :group do
|
@@ -35,7 +35,7 @@ describe Deimos::Configurable do
|
|
35
35
|
num_calls += 1
|
36
36
|
num_calls
|
37
37
|
end
|
38
|
-
MyConfig.
|
38
|
+
MyConfig.define_settings do
|
39
39
|
setting :set_with_proc, default_proc: value_proc
|
40
40
|
end
|
41
41
|
expect(num_calls).to eq(0)
|
@@ -95,7 +95,7 @@ describe Deimos::Configurable do
|
|
95
95
|
end
|
96
96
|
|
97
97
|
it 'should add or redefine settings' do
|
98
|
-
MyConfig.
|
98
|
+
MyConfig.define_settings do
|
99
99
|
setting :group do
|
100
100
|
setting :set6, 15
|
101
101
|
setting :set5, (proc { 15 })
|
@@ -124,14 +124,13 @@ describe Deimos::Configurable do
|
|
124
124
|
expect(MyConfig.config.listy_objects.first.list1).to eq(0)
|
125
125
|
|
126
126
|
# This should not remove any keys
|
127
|
-
MyConfig.
|
127
|
+
MyConfig.define_settings do
|
128
128
|
setting :group do
|
129
129
|
setting :set6, 20
|
130
130
|
end
|
131
131
|
end
|
132
132
|
expect(MyConfig.config.group.set6).to eq(20)
|
133
133
|
expect(MyConfig.config.group.set5.call).to eq(15)
|
134
|
-
|
135
134
|
end
|
136
135
|
|
137
136
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deimos-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.0.pre.
|
4
|
+
version: 1.4.0.pre.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Orner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro-patches
|