module Hocon::Impl::AbstractConfigObject
Constants
- ConfigBugOrBrokenError
- ConfigNotResolvedError
Public Class Methods
Source
# File lib/hocon/impl/abstract_config_object.rb, line 144 def self.merge_origins(stack) if stack.empty? raise ConfigBugOrBrokenError, "can't merge origins on empty list" end origins = [] first_origin = nil num_merged = 0 stack.each do |v| if first_origin.nil? first_origin = v.origin end if (v.is_a?(Hocon::Impl::AbstractConfigObject)) && (v.resolve_status == Hocon::Impl::ResolveStatus::RESOLVED) && v.empty? # don't include empty files or the .empty() # config in the description, since they are # likely to be "implementation details" else origins.push(v.origin) num_merged += 1 end end if num_merged == 0 # the configs were all empty, so just use the first one origins.push(first_origin) end Hocon::Impl::SimpleConfigOrigin.merge_origins(origins) end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 23 def initialize(origin) super(origin) @config = Hocon::Impl::SimpleConfig.new(self) end
Hocon::Impl::AbstractConfigValue::new
Public Instance Methods
Source
# File lib/hocon/impl/abstract_config_object.rb, line 184 def [](key) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `[]`" end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 200 def []=(key, value) raise we_are_immutable("[]=") end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 89 def attempt_peek_with_partial_resolve(key) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `attempt_peek_with_partial_resolve`" end
Look up the key on an only-partially-resolved object, with no transformation or type conversion of any kind; if ‘this’ is not resolved then try to look up the key anyway if possible.
@param key
key to look up
@return the value of the key, or null if known not to exist @throws ConfigNotResolvedError
if can't figure out key's value (or existence) without more resolving
Source
# File lib/hocon/impl/abstract_config_object.rb, line 196 def clear raise we_are_immutable("clear") end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 132 def construct_delayed_merge(origin, stack) Hocon::Impl::ConfigDelayedMergeObject.new(origin, stack) end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 212 def delete(key) raise we_are_immutable("delete") end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 136 def merged_with_object(fallback) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `merged_with_object`" end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 128 def new_copy(origin) new_copy_with_status(resolve_status, origin) end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 124 def new_copy_with_status(status, origin) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `new_copy_with_status`" end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 71 def peek_assuming_resolved(key, original_path) begin attempt_peek_with_partial_resolve(key) rescue ConfigNotResolvedError => e raise Hocon::Impl::ConfigImpl.improve_not_resolved(original_path, e) end end
This looks up the key with no transformation or type conversion of any kind, and returns null if the key is not present. The object must be resolved along the nodes needed to get the key or ConfigNotResolvedError
will be thrown.
@param key @return the unmodified raw value or null
Source
# File lib/hocon/impl/abstract_config_object.rb, line 96 def peek_path(path) peek_path_from_obj(self, path) end
Looks up the path with no transformation or type conversion. Returns null if the path is not found; throws ConfigException.NotResolved if we need to go through an unresolved node to look up the path.
Source
# File lib/hocon/impl/abstract_config_object.rb, line 100 def peek_path_from_obj(obj, path) begin # we'll fail if anything along the path can't be looked at without resolving path_next = path.remainder v = obj.attempt_peek_with_partial_resolve(path.first) if path_next.nil? v else if v.is_a?(Hocon::Impl::AbstractConfigObject) peek_path_from_obj(v, path_next) else nil end end rescue ConfigNotResolvedError => e raise Hocon::Impl::ConfigImpl.improve_not_resolved(path, e) end end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 204 def putAll(map) raise we_are_immutable("putAll") end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 180 def relativized(path) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `relativized`" end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 208 def remove(key) raise we_are_immutable("remove") end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 188 def render_value_to_sb(sb, indent, at_root, options) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `render_value_to_sb`" end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 176 def resolve_substitutions(context, source) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `resolve_substituions`" end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 28 def to_config @config end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 32 def to_fallback_value self end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 120 def value_type Hocon::ConfigValueType::OBJECT end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 192 def we_are_immutable(method) Hocon::Impl::UnsupportedOperationError.new("ConfigObject is immutable, you can't call Map.#{method}") end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 140 def with_fallback(mergeable) super(mergeable) end
Hocon::Impl::AbstractConfigValue#with_fallback
Source
# File lib/hocon/impl/abstract_config_object.rb, line 36 def with_only_key(key) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `with_only_key`" end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 52 def with_only_path(path) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `with_only_path`" end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 48 def with_only_path_or_nil(path) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `with_only_path_or_nil`" end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 216 def with_origin(origin) super(origin) end
Hocon::Impl::AbstractConfigValue#with_origin
Source
# File lib/hocon/impl/abstract_config_object.rb, line 60 def with_path_value(path, value) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `with_path_value`" end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 44 def with_value(key, value) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `with_value`" end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 40 def without_key(key) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `without_key`" end
Source
# File lib/hocon/impl/abstract_config_object.rb, line 56 def without_path(path) raise ConfigBugOrBrokenError, "subclasses of AbstractConfigObject should override `without_path`" end