process_settings 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/process_settings/monitor.rb +27 -0
- data/lib/process_settings/version.rb +1 -1
- data/lib/process_settings.rb +24 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0763f49b68a52e5858cf539fc18adaa575d0e374b3f0490e63c972b340dc75ab
|
4
|
+
data.tar.gz: d8d82eb1674afbfaa0ffd1e94b12555af51811c73f84f8cb3ebf11e0f6602581
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 506febcd2fee4fec9e19f44e3de774a2ea2878526b80e93e71f3f51eab6ff807983914f998a0576c294b9b0e8bda6d47a7cc81704fa59ef8514f61cd0d1e1e97
|
7
|
+
data.tar.gz: 2e2d84671c400c0c9a1711957e33c6757fe1420879cf4f830ba167592d3cb1420c8f345df46189de4be299480b63772609531ef25761a37f0318b9e53ab358e7
|
@@ -31,6 +31,33 @@ module ProcessSettings
|
|
31
31
|
start
|
32
32
|
end
|
33
33
|
|
34
|
+
# []
|
35
|
+
#
|
36
|
+
# This is the main entry point for looking up settings on the Monitor instance.
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
#
|
40
|
+
# ['path', 'to', 'setting']
|
41
|
+
#
|
42
|
+
# will return 42 in this example settings YAML:
|
43
|
+
# +code+
|
44
|
+
# path:
|
45
|
+
# to:
|
46
|
+
# setting:
|
47
|
+
# 42
|
48
|
+
# +code+
|
49
|
+
#
|
50
|
+
# @param [Array(String)] path The path of one or more strings.
|
51
|
+
#
|
52
|
+
# @param [Hash] dynamic_context Optional dynamic context hash. It will be merged with the static context.
|
53
|
+
#
|
54
|
+
# @param [boolean] required If true (default) will raise `SettingsPathNotFound` if not found; otherwise returns `nil` if not found.
|
55
|
+
#
|
56
|
+
# @return setting value
|
57
|
+
def [](*path, dynamic_context: {}, required: true)
|
58
|
+
targeted_value(*path, dynamic_context: dynamic_context, required: required)
|
59
|
+
end
|
60
|
+
|
34
61
|
# starts listening for changes
|
35
62
|
# Note: This method creates a new thread that will be monitoring for changes
|
36
63
|
# do to the nature of how the Listen gem works, there is no record of
|
data/lib/process_settings.rb
CHANGED
@@ -7,8 +7,31 @@ require 'process_settings/monitor'
|
|
7
7
|
|
8
8
|
module ProcessSettings
|
9
9
|
class << self
|
10
|
+
# []
|
11
|
+
#
|
12
|
+
# This is the main entry point for looking up settings in the process.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
#
|
16
|
+
# ProcessSettings['path', 'to', 'setting']
|
17
|
+
#
|
18
|
+
# will return 42 in this example settings YAML:
|
19
|
+
# +code+
|
20
|
+
# path:
|
21
|
+
# to:
|
22
|
+
# setting:
|
23
|
+
# 42
|
24
|
+
# +code+
|
25
|
+
#
|
26
|
+
# @param [Array(String)] path The path of one or more strings.
|
27
|
+
#
|
28
|
+
# @param [Hash] dynamic_context Optional dynamic context hash. It will be merged with the static context.
|
29
|
+
#
|
30
|
+
# @param [boolean] required If true (default) will raise `SettingsPathNotFound` if not found; otherwise returns `nil` if not found.
|
31
|
+
#
|
32
|
+
# @return setting value
|
10
33
|
def [](*path, dynamic_context: {}, required: true)
|
11
|
-
Monitor.instance
|
34
|
+
Monitor.instance[*path, dynamic_context: dynamic_context, required: required]
|
12
35
|
end
|
13
36
|
end
|
14
37
|
end
|