class Hocon::Impl::ConfigNodeField
Constants
- Tokens
Attributes
children[R]
Public Class Methods
new(children)
click to toggle source
# File lib/hocon/impl/config_node_field.rb, line 17 def initialize(children) @children = children end
Public Instance Methods
comments()
click to toggle 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
path()
click to toggle 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
replace_value(new_value)
click to toggle 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
separator()
click to toggle 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
tokens()
click to toggle source
# File lib/hocon/impl/config_node_field.rb, line 23 def tokens tokens = [] @children.each do |child| tokens += child.tokens end tokens end
value()
click to toggle 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