class Hocon::Impl::SimpleConfigObject::ResolveModifier

Attributes

context[RW]
source[R]

Public Class Methods

new(context, source) click to toggle source
# File lib/hocon/impl/simple_config_object.rb, line 323
def initialize(context, source)
  @context = context
  @source = source
  @original_restrict = context.restrict_to_child
end

Public Instance Methods

modify_child_may_throw(key, v) click to toggle source
# File lib/hocon/impl/simple_config_object.rb, line 329
def modify_child_may_throw(key, v)
   if @context.is_restricted_to_child
    if key == @context.restrict_to_child.first
      remainder = @context.restrict_to_child.remainder
      if remainder != nil
        result = @context.restrict(remainder).resolve(v, @source)
        @context = result.context.unrestricted.restrict(@original_restrict)
        return result.value
      else
        # we don't want to resolve the leaf child
        return v
      end
    else
      # not in the restrictToChild path
      return v
    end
  else
    # no restrictToChild, resolve everything
    result = @context.unrestricted.resolve(v, @source)
    @context = result.context.unrestricted.restrict(@original_restrict)
    result.value
  end
end