class Hocon::Impl::ConfigNodePath
Constants
- Tokens
Attributes
Public Class Methods
Source
# File lib/hocon/impl/config_node_path.rb, line 11 def initialize(path, tokens) @path = path @tokens = tokens end
Public Instance Methods
Source
# File lib/hocon/impl/config_node_path.rb, line 38 def first tokens_copy = tokens.clone (0..tokens_copy.size - 1).each do |i| if Tokens.unquoted_text?(tokens_copy[i]) && tokens_copy[i].token_text == "." return self.class.new(@path.sub_path(0, 1), tokens_copy[0, i]) end end self end
Source
# File lib/hocon/impl/config_node_path.rb, line 22 def sub_path(to_remove) period_count = 0 tokens_copy = tokens.clone (0..tokens_copy.size - 1).each do |i| if Tokens.unquoted_text?(tokens_copy[i]) && tokens_copy[i].token_text == "." period_count += 1 end if period_count == to_remove return self.class.new(@path.sub_path_to_end(to_remove), tokens_copy[i + 1..tokens_copy.size]) end end raise ConfigBugOrBrokenError, "Tried to remove too many elements from a Path node" end