Method: Hocon::Impl::ConfigNodeObject#has_value

Defined in:
lib/hocon/impl/config_node_object.rb

#has_value(desired_path) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/hocon/impl/config_node_object.rb', line 20

def has_value(desired_path)
  @children.each do |node|
    if node.is_a?(Hocon::Impl::ConfigNodeField)
      field = node
      key = field.path.value
      if key == desired_path || key.starts_with(desired_path)
        return true
      elsif desired_path.starts_with(key)
        if field.value.is_a?(self.class)
          obj = field.value
          remaining_path = desired_path.sub_path_to_end(key.length)
          if obj.has_value(remaining_path)
            return true
          end
        end
      end
    end
  end
  false
end