class Hocon::Impl::PathBuilder
Public Class Methods
Source
# File lib/hocon/impl/path_builder.rb, line 9 def initialize @keys = [] @result = nil end
Public Instance Methods
Source
# File lib/hocon/impl/path_builder.rb, line 20 def append_key(key) check_can_append @keys.push(key) end
Source
# File lib/hocon/impl/path_builder.rb, line 25 def append_path(path) check_can_append first = path.first remainder = path.remainder loop do @keys.push(first) if !remainder.nil? first = remainder.first remainder = remainder.remainder else break end end end
Source
# File lib/hocon/impl/path_builder.rb, line 14 def check_can_append if @result raise Hocon::ConfigError::ConfigBugOrBrokenError, "Adding to PathBuilder after getting result" end end
Source
# File lib/hocon/impl/path_builder.rb, line 43 def result # note: if keys is empty, we want to return nil, which is a valid # empty path if @result.nil? remainder = nil while !@keys.empty? key = @keys.pop remainder = Hocon::Impl::Path.new(key, remainder) end @result = remainder end @result end