process_settings 0.11.0 → 0.11.1.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -5
- data/lib/process_settings/testing/helpers.rb +3 -3
- data/lib/process_settings/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 074a7a2fc453de9cd6f46546ebe6040c61ebc2532df5bcfa07cb6841b70ef793
|
4
|
+
data.tar.gz: 01b1658b4a8d7cef95367cc91685c544417fac81633a736cbab87d791dda17ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0025db7a10cc0157579a3bb3890b092626f613e01da5dd132e9017e634393b7fa15eb724070be939fe17e37816df08c43585dbdecf37f0437fd5b25261dc3874
|
7
|
+
data.tar.gz: c517c8d7e7d96f17e1fb1de6e0484793cbc9e9ae32add2238b48fae6b4619cb862e03ba7d3786490134acf1226f41db2b4bf204b4862010e51d5a1fc5c16e26f
|
data/README.md
CHANGED
@@ -126,16 +126,20 @@ The simplest approach--as shown above--is to read the latest settings at any tim
|
|
126
126
|
http_version = ProcessSettings['frontend', 'http_version']
|
127
127
|
```
|
128
128
|
|
129
|
-
#### Register
|
130
|
-
Alternatively, if you need to execute
|
129
|
+
#### Register a `when_updated` Callback
|
130
|
+
Alternatively, if you need to execute initially and whenever the value is updated, register a callback with `ProcessSettings.instance#when_updated`:
|
131
131
|
```
|
132
|
-
ProcessSettings.instance.
|
132
|
+
ProcessSettings.instance.when_updated do
|
133
133
|
logger.level = ProcessSettings['frontend', 'log_level']
|
134
134
|
end
|
135
135
|
```
|
136
|
-
|
136
|
+
By default, the `when_updated` block is called initially when registered. We've found this to be convenient in most cases; it can be disabled by passing `initial_update: false`, in which case the block will be called 0 or more times in the future, when any of the process settings for this process change.
|
137
|
+
|
138
|
+
`when_updated` is idempotent.
|
137
139
|
|
138
|
-
|
140
|
+
In case you need to cancel the callback later, `when_updated` returns a handle (the block itself) which can later be passed into `cancel_when_updated`.
|
141
|
+
|
142
|
+
Note that all callbacks run sequentially on the shared change monitoring thread, so please be considerate!
|
139
143
|
|
140
144
|
## Targeting
|
141
145
|
Each settings YAML file has an optional `target` key at the top level, next to `settings`.
|
@@ -12,10 +12,10 @@ module ProcessSettings
|
|
12
12
|
class << self
|
13
13
|
def included(including_klass)
|
14
14
|
after_method =
|
15
|
-
if including_klass.respond_to?(:
|
16
|
-
:teardown
|
17
|
-
else
|
15
|
+
if including_klass.respond_to?(:after)
|
18
16
|
:after
|
17
|
+
else
|
18
|
+
:teardown
|
19
19
|
end
|
20
20
|
|
21
21
|
including_klass.send(after_method) do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: process_settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca
|
@@ -108,9 +108,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- - "
|
111
|
+
- - ">"
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version:
|
113
|
+
version: 1.3.1
|
114
114
|
requirements: []
|
115
115
|
rubygems_version: 3.0.3
|
116
116
|
signing_key:
|