class Hocon::Impl::ConfigNodeField
Constants
- Tokens
Attributes
Public Class Methods
Source
# File lib/hocon/impl/config_node_field.rb, line 17 def initialize(children) @children = children end
Public Instance Methods
Source
# File lib/hocon/impl/config_node_field.rb, line 72 def comments comments = [] @children.each do |child| if child.is_a?(Hocon::Impl::ConfigNodeComment) comments << child.comment_text end end comments end
Source
# File lib/hocon/impl/config_node_field.rb, line 51 def path @children.each do |child| if child.is_a?(Hocon::Impl::ConfigNodePath) return child end end raise Hocon::ConfigError::ConfigBugOrBrokenError, "Field node doesn't have a path" end
Source
# File lib/hocon/impl/config_node_field.rb, line 31 def replace_value(new_value) children_copy = @children.clone children_copy.each_with_index do |child, i| if child.is_a?(Hocon::Impl::AbstractConfigNodeValue) children_copy[i] = new_value return self.class.new(children_copy) end end raise Hocon::ConfigError::ConfigBugOrBrokenError, "Field node doesn't have a value" end
Source
# File lib/hocon/impl/config_node_field.rb, line 60 def separator @children.each do |child| if child.is_a?(Hocon::Impl::ConfigNodeSingleToken) t = child.token if t == Tokens::PLUS_EQUALS or t == Tokens::COLON or t == Tokens::EQUALS return t end end end nil end
Source
# File lib/hocon/impl/config_node_field.rb, line 23 def tokens tokens = [] @children.each do |child| tokens += child.tokens end tokens end
Source
# File lib/hocon/impl/config_node_field.rb, line 42 def value @children.each do |child| if child.is_a?(Hocon::Impl::AbstractConfigNodeValue) return child end end raise Hocon::ConfigError::ConfigBugOrBrokenError, "Field node doesn't have a value" end