Class: Hocon::Impl::ConfigDelayedMergeObject
Overview
This is just like ConfigDelayedMerge except we know statically that it will turn out to be an object.
Constant Summary
AbstractConfigObject::ConfigBugOrBrokenError, AbstractConfigObject::ConfigNotResolvedError
AbstractConfigValue::ConfigBugOrBrokenError, AbstractConfigValue::ConfigImplUtil, AbstractConfigValue::ResolveStatus
Instance Attribute Summary collapse
#origin
Class Method Summary
collapse
Instance Method Summary
collapse
-
#==(other) ⇒ Object
-
#[](key) ⇒ Object
-
#attempt_peek_with_partial_resolve(key) ⇒ Object
-
#can_equal(other) ⇒ Object
-
#each ⇒ Object
-
#empty? ⇒ Boolean
-
#has_descendant?(descendant) ⇒ Boolean
-
#has_key?(key) ⇒ Boolean
-
#has_value?(value) ⇒ Boolean
-
#hash ⇒ Object
-
#ignores_fallbacks? ⇒ Boolean
-
#initialize(origin, stack) ⇒ ConfigDelayedMergeObject
constructor
A new instance of ConfigDelayedMergeObject.
-
#keys ⇒ Object
-
#make_replacement(context, skipping) ⇒ Object
-
#merged_with_non_object(fallback) ⇒ Object
-
#merged_with_object(fallback) ⇒ Object
-
#merged_with_the_unmergeable(fallback) ⇒ Object
-
#new_copy(status, origin) ⇒ Object
-
#relativized(prefix) ⇒ Object
-
#render_to_sb(sb, indent, at_root, at_key, options) ⇒ Object
-
#replace_child(child, replacement) ⇒ Object
-
#resolve_status ⇒ Object
-
#resolve_substitutions(context, source) ⇒ Object
-
#size ⇒ Object
-
#unmerged_values ⇒ Object
-
#unwrapped ⇒ Object
-
#values ⇒ Object
-
#with_only_key(key) ⇒ Object
No implementation of withFallback here, just use the implementation in the super-class.
-
#with_only_path(key) ⇒ Object
-
#with_only_path_or_nil(key) ⇒ Object
-
#with_value(key_or_path, value = nil) ⇒ Object
-
#without_key(key) ⇒ Object
-
#without_path(key) ⇒ Object
#[]=, #clear, #construct_delayed_merge, #delete, merge_origins, #new_copy_with_status, #peek_assuming_resolved, #peek_path, #peek_path_from_obj, #putAll, #remove, #render_value_to_sb, #to_config, #to_fallback_value, #value_type, #we_are_immutable, #with_fallback, #with_origin, #with_path_value
#at_key, #at_key_with_origin, #at_path, #at_path_with_origin, #construct_delayed_merge, #delay_merge, has_descendant_in_list?, indent, #inspect, #merged_stack_with_non_object, #merged_stack_with_object, #merged_stack_with_the_unmergeable, #render, #render_value_to_sb, replace_child_in_list, #require_not_ignoring_fallbacks, #to_fallback_value, #to_s, #transform_to_string, #with_fallback, #with_fallbacks_ignored, #with_origin
#at_key, #at_path, #origin, #render, #value_type, #with_fallback, #with_origin
#with_fallback
#get, #to_config, #with_fallback, #with_origin
Constructor Details
Returns a new instance of ConfigDelayedMergeObject.
Instance Attribute Details
#stack ⇒ Object
Returns the value of attribute stack.
34
35
36
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 34
def stack
@stack
end
|
Class Method Details
.not_resolved ⇒ Object
151
152
153
154
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 151
def self.not_resolved
error_message = "need to Config#resolve() before using this object, see the API docs for Config#resolve()"
Hocon::ConfigError::ConfigNotResolvedError.new(error_message, nil)
end
|
.unmergeable?(object) ⇒ Boolean
192
193
194
195
196
197
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 192
def self.unmergeable?(object)
object.class.included_modules.include?(Hocon::Impl::Unmergeable)
end
|
Instance Method Details
#==(other) ⇒ Object
133
134
135
136
137
138
139
140
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 133
def ==(other)
if other.is_a? Hocon::Impl::ConfigDelayedMergeObject
can_equal(other) && (@stack == other.stack || @stack.equal?(other.stack))
else
false
end
end
|
#[](key) ⇒ Object
160
161
162
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 160
def [](key)
raise self.class.not_resolved
end
|
#attempt_peek_with_partial_resolve(key) ⇒ Object
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 199
def attempt_peek_with_partial_resolve(key)
@stack.each do |layer|
if layer.is_a?(Hocon::Impl::AbstractConfigObject)
v = layer.attempt_peek_with_partial_resolve(key)
if !v.nil?
if v.ignores_fallbacks?
return v
else
next
end
elsif self.class.unmergeable?(layer)
error_message = "should not be reached: unmergeable object returned null value"
raise Hocon::ConfigError::ConfigBugOrBrokenError.new(error_message, nil)
else
next
end
elsif self.class.unmergeable?(layer)
error_message = "Key '#{key}' is not available at '#{origin.description}'" +
"because value at '#{layer.origin.description}' has not been resolved" +
" and may turn out to contain or hide '#{key}'. Be sure to Config#resolve()" +
" before using a config object"
raise Hocon::ConfigError::ConfigNotResolvedError.new(error_message, nil)
elsif layer.resolved_status == ResolveStatus::UNRESOLVED
if !layer.is_a?(Hocon::Impl::ConfigList)
error_message = "Expecting a list here, not #{layer}"
raise Hocon::ConfigError::ConfigBugOrBrokenError.new(error_message, nil)
end
return nil
else
if !layer.ignores_fallbacks?
error_message = "resolved non-object should ignore fallbacks"
raise Hocon::ConfigError::ConfigBugOrBrokenError.new(error_message, nil)
end
return nil
end
end
error_message = "Delayed merge stack does not contain any unmergeable values"
raise Hocon::ConfigError::ConfigBugOrBrokenError.new(error_message, nil)
end
|
#can_equal(other) ⇒ Object
#each ⇒ Object
172
173
174
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 172
def each
raise self.class.not_resolved
end
|
#empty? ⇒ Boolean
176
177
178
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 176
def empty?
raise self.class.not_resolved
end
|
#has_descendant?(descendant) ⇒ Boolean
#has_key?(key) ⇒ Boolean
164
165
166
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 164
def has_key?(key)
raise self.class.not_resolved
end
|
#has_value?(value) ⇒ Boolean
168
169
170
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 168
def has_value?(value)
raise self.class.not_resolved
end
|
#hash ⇒ Object
142
143
144
145
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 142
def hash
@stack.hash
end
|
#ignores_fallbacks? ⇒ Boolean
#keys ⇒ Object
180
181
182
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 180
def keys
raise self.class.not_resolved
end
|
#make_replacement(context, skipping) ⇒ Object
#merged_with_non_object(fallback) ⇒ Object
92
93
94
95
96
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 92
def merged_with_non_object(fallback)
require_not_ignoring_fallbacks
merged_stack_with_non_object(@stack, fallback)
end
|
#merged_with_object(fallback) ⇒ Object
88
89
90
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 88
def merged_with_object(fallback)
merged_with_non_object(fallback)
end
|
#merged_with_the_unmergeable(fallback) ⇒ Object
82
83
84
85
86
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 82
def merged_with_the_unmergeable(fallback)
require_not_ignoring_fallbacks
merged_stack_with_the_unmergeable(@stack, fallback)
end
|
#new_copy(status, origin) ⇒ Object
#relativized(prefix) ⇒ Object
70
71
72
73
74
75
76
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 70
def relativized(prefix)
new_stack = []
@stack.each { |o|
new_stack << o.relativized(prefix)
}
self.class.new(origin, new_stack)
end
|
#render_to_sb(sb, indent, at_root, at_key, options) ⇒ Object
147
148
149
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 147
def render_to_sb(sb, indent, at_root, at_key, options)
Hocon::Impl::ConfigDelayedMerge.render_value_to_sb_from_stack(@stack, sb, indent, at_root, at_key, options)
end
|
#replace_child(child, replacement) ⇒ Object
57
58
59
60
61
62
63
64
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 57
def replace_child(child, replacement)
new_stack = Hocon::Impl::AbstractConfigValue.replace_child_in_list(@stack, child, replacement)
if new_stack == nil
nil
else
self.class.new(origin, new_stack)
end
end
|
#resolve_substitutions(context, source) ⇒ Object
44
45
46
47
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 44
def resolve_substitutions(context, source)
merged = Hocon::Impl::ConfigDelayedMerge.resolve_substitutions(self, @stack, context, source)
merged.as_object_result
end
|
#size ⇒ Object
188
189
190
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 188
def size
raise self.class.not_resolved
end
|
#unmerged_values ⇒ Object
125
126
127
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 125
def unmerged_values
@stack
end
|
#unwrapped ⇒ Object
156
157
158
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 156
def unwrapped
raise self.class.not_resolved
end
|
#values ⇒ Object
184
185
186
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 184
def values
raise self.class.not_resolved
end
|
#with_only_key(key) ⇒ Object
No implementation of withFallback here, just use the implementation in the super-class
101
102
103
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 101
def with_only_key(key)
raise self.class.not_resolved
end
|
#with_only_path(key) ⇒ Object
113
114
115
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 113
def with_only_path(key)
raise self.class.not_resolved
end
|
#with_only_path_or_nil(key) ⇒ Object
109
110
111
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 109
def with_only_path_or_nil(key)
raise self.class.not_resolved
end
|
#with_value(key_or_path, value = nil) ⇒ Object
121
122
123
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 121
def with_value(key_or_path, value = nil)
raise self.class.not_resolved
end
|
#without_key(key) ⇒ Object
105
106
107
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 105
def without_key(key)
raise self.class.not_resolved
end
|
#without_path(key) ⇒ Object
117
118
119
|
# File 'lib/hocon/impl/config_delayed_merge_object.rb', line 117
def without_path(key)
raise self.class.not_resolved
end
|