consul-templaterb 1.19.0 → 1.20.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c205b2067eaf6526b4885b4303c580e2b52d4e770371db3d9678908c013b19fd
4
- data.tar.gz: 0fe4a33a112ff1801391d4c6df928d0f63a7bc606cd0b2aa57f1907bbb3a50d1
3
+ metadata.gz: fdc12c65083f1f666615eec05c7b092839f28e05ad855a745271114305719a88
4
+ data.tar.gz: c0d46a14a91d4622ba7819a1d0e6bda38410f9b3fde5c1c89fa7d141dd837f36
5
5
  SHA512:
6
- metadata.gz: abef2e2b0cf9dec0ab94aaa04ad3377c0f13171cc9ffc8fa83a47a99c6a99ff229834c76c4209d1ca3d854d8006450fd8bb745f7cb594b444e2c83fc7711ec61
7
- data.tar.gz: 6c818a568ed87d660545a03f3308c4b97cd5b3e17a80d7d7d38c1c79453fd20e73a8912b6a1da9b259b368124fab3abad7c7930cca10f6eabc1dd0475874309a
6
+ metadata.gz: a78247bdaba4504bf6486faa24690f85fa86007ce49704def7f7dd123f2ea229c6b325c1c8e83c17d843f3c9f45a1a5708bbc48976a2bcb1b54950c07e74f3e8
7
+ data.tar.gz: 44c4afb432414e4bca30e52617924e76c500bf9c5e289ba42224853f13d2ad13189d659dec310347ac3ad9e152e0fbedc8daa47a8b72db8df0014f3bbe4968cd
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## (UNRELEASED)
4
4
 
5
+ ## 1.20.0 (October 16, 2019)
6
+
7
+ IMPROVEMENTS:
8
+ * unit tests for `checks_for_node`
9
+ * any method of array/hash can be called on result now
10
+
5
11
  ## 1.19.0 (October 14, 2019)
6
12
 
7
13
  IMPROVEMENTS:
@@ -40,16 +40,158 @@ most of those metrics to [Prometheus](https://prometheus.io/).
40
40
  ## Common re-implemented functions for all objects
41
41
 
42
42
  Most objects returned by all those functions are contained within a `.result` object. However, in order
43
- to avoid having to write .result in all templates, some shortcuts have been added:
44
-
45
- * `[]` allow to either access values for map-based data or arrays
46
- * for all objects: `.each`, `sort`, `.select`, `.each_value`, `.count`, `.empty?`
47
- * additionnaly, for map based results, the following methods are available: `.keys`, `.values`, `.each_pair`,
48
- `.each_value`
49
-
50
- See [lib/consul/async/consul_template.rb:230](lib/consul/async/consul_template.rb#L230) and
51
- [lib/consul/async/consul_template.rb:260](lib/consul/async/consul_template.rb#L260) for up to date list of
52
- all those methods.
43
+ to avoid having to write .result in all templates, some shortcuts have been added: `[]` allow to either access values for map-based data or arrays.
44
+
45
+ Also available for all results:
46
+
47
+ ### Common methods available for all objects
48
+
49
+ * .all?
50
+ * .any?
51
+ * .assoc
52
+ * .chunk
53
+ * .chunk_while
54
+ * .class
55
+ * .clear
56
+ * .collect
57
+ * .collect_concat
58
+ * .compact
59
+ * .count
60
+ * .cycle
61
+ * .detect
62
+ * .dig
63
+ * .display
64
+ * .drop
65
+ * .drop_while
66
+ * .dup
67
+ * .each
68
+ * .each_cons
69
+ * .each_entry
70
+ * .each_slice
71
+ * .each_with_index
72
+ * .each_with_object
73
+ * .empty?
74
+ * .entries
75
+ * .enum_for
76
+ * .eql?
77
+ * .equal?
78
+ * .extend
79
+ * .fetch
80
+ * .find
81
+ * .find_all
82
+ * .find_index
83
+ * .first
84
+ * .flat_map
85
+ * .flatten
86
+ * .grep
87
+ * .grep_v
88
+ * .group_by
89
+ * .hash
90
+ * .include?
91
+ * .index
92
+ * .inject
93
+ * .inspect
94
+ * .is_a?
95
+ * .itself
96
+ * .keep_if
97
+ * .kind_of?
98
+ * .lazy
99
+ * .length
100
+ * .map
101
+ * .max
102
+ * .max_by
103
+ * .member?
104
+ * .min
105
+ * .min_by
106
+ * .minmax
107
+ * .minmax_by
108
+ * .nil?
109
+ * .none?
110
+ * .object_id
111
+ * .one?
112
+ * .partition
113
+ * .pp
114
+ * .rassoc
115
+ * .reduce
116
+ * .reject
117
+ * .replace
118
+ * .reverse_each
119
+ * .select
120
+ * .shift
121
+ * .size
122
+ * .slice
123
+ * .slice_after
124
+ * .slice_before
125
+ * .slice_when
126
+ * .sort
127
+ * .sort_by
128
+ * .sum
129
+ * .take
130
+ * .take_while
131
+ * .tap
132
+ * .to_a
133
+ * .to_enum
134
+ * .to_h
135
+ * .to_s
136
+ * .uniq
137
+ * .values_at
138
+ * .yield_self
139
+ * .zip
140
+
141
+ ### Methods available for Array objects
142
+
143
+ * .append
144
+ * .at
145
+ * .bsearch
146
+ * .bsearch_index
147
+ * .combination
148
+ * .concat
149
+ * .each_index
150
+ * .fill
151
+ * .insert
152
+ * .join
153
+ * .last
154
+ * .pack
155
+ * .permutation
156
+ * .pop
157
+ * .prepend
158
+ * .product
159
+ * .push
160
+ * .repeated_combination
161
+ * .repeated_permutation
162
+ * .reverse
163
+ * .rindex
164
+ * .rotate
165
+ * .sample
166
+ * .shuffle
167
+ * .to_ary
168
+ * .transpose
169
+ * .unshift
170
+
171
+ ### Methods available for hash objects
172
+
173
+ * .compare_by_identity
174
+ * .compare_by_identity?
175
+ * .each_key
176
+ * .each_pair
177
+ * .each_value
178
+ * .fetch_values
179
+ * .has_key?
180
+ * .has_value?
181
+ * .invert
182
+ * .key
183
+ * .key?
184
+ * .keys
185
+ * .merge
186
+ * .rehash
187
+ * .store
188
+ * .to_hash
189
+ * .to_proc
190
+ * .transform_keys
191
+ * .transform_values
192
+ * .update
193
+ * .value?
194
+ * .values
53
195
 
54
196
  ## coordinate
55
197
 
@@ -364,8 +364,6 @@ module Consul
364
364
  end
365
365
 
366
366
  class ConsulTemplateAbstract
367
- extend Forwardable
368
- def_delegators :result_delegate, :each, :[], :sort, :select, :each_value, :count, :empty?, :map
369
367
  attr_reader :result, :endpoint, :seen_at
370
368
  def initialize(consul_endpoint)
371
369
  @endpoint = consul_endpoint
@@ -383,10 +381,22 @@ module Consul
383
381
  @endpoint.ready?
384
382
  end
385
383
 
384
+ def method_missing(method_name, *args, &block)
385
+ if result_delegate.respond_to?(method_name)
386
+ result_delegate.send(method_name, *args, &block)
387
+ else
388
+ super
389
+ end
390
+ end
391
+
392
+ def respond_to_missing?(method_name, *args)
393
+ result_delegate.respond_to?(method_name, *args)
394
+ end
395
+
386
396
  protected
387
397
 
388
398
  def result_delegate
389
- result.json
399
+ result.json.freeze
390
400
  end
391
401
 
392
402
  def parse_result(res)
@@ -395,14 +405,12 @@ module Consul
395
405
  end
396
406
 
397
407
  class ConsulTemplateAbstractMap < ConsulTemplateAbstract
398
- def_delegators :result_delegate, :each, :[], :keys, :sort, :select, :values, :each_pair, :each_value, :count, :empty?, :map
399
408
  def initialize(consul_endpoint)
400
409
  super(consul_endpoint)
401
410
  end
402
411
  end
403
412
 
404
413
  class ConsulTemplateAbstractArray < ConsulTemplateAbstract
405
- def_delegators :result_delegate, :each, :[], :sort, :select, :each_value, :count, :empty?, :map, :to_a
406
414
  def initialize(consul_endpoint)
407
415
  super(consul_endpoint)
408
416
  end
@@ -1,5 +1,5 @@
1
1
  module Consul
2
2
  module Async
3
- VERSION = '1.19.0'.freeze
3
+ VERSION = '1.20.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consul-templaterb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.0
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SRE Core Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-14 00:00:00.000000000 Z
11
+ date: 2019-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-http-request