lib/consul/async/consul_template.rb in consul-templaterb-1.18.0 vs lib/consul/async/consul_template.rb in consul-templaterb-1.18.1

- old
+ new

@@ -26,15 +26,16 @@ @endp_manager = endpoints_manager end def as_json(url, default_value, refresh_delay_secs: 10) conf = JSONConfiguration.new(url: url, min_duration: refresh_delay_secs, retry_on_non_diff: refresh_delay_secs) - ret = if default_value.is_a?(Array) - ConsulTemplateJSONArray.new(JSONEndpoint.new(conf, url, default_value)) - else - ConsulTemplateJSONObject.new(JSONEndpoint.new(conf, url, default_value)) - end - @endp_manager.create_if_missing(url, {}) { ret } + @endp_manager.create_if_missing(url, {}) do + if default_value.is_a?(Array) + ConsulTemplateJSONArray.new(JSONEndpoint.new(conf, url, default_value)) + else + ConsulTemplateJSONObject.new(JSONEndpoint.new(conf, url, default_value)) + end + end end end # Encapsulation of endpoints to get coordinates class Coordinate