Module: HAProxy::Treetop

Extended by:
Treetop
Included in:
Treetop
Defined in:
lib/haproxy/treetop/nodes.rb

Defined Under Namespace

Modules: ConfigBlockContainer, OptionalValueElement, ServerContainer, ServiceAddressContainer, StrippedTextContent Classes: BackendHeader, BackendSection, BlankLine, Char, CommentLine, CommentText, ConfigBlock, ConfigLine, ConfigurationFile, DefaultsHeader, DefaultsSection, FrontendHeader, FrontendSection, GlobalHeader, GlobalSection, Host, Keyword, LineBreak, ListenHeader, ListenSection, OptionLine, Port, ProxyName, ServerLine, ServerName, ServiceAddress, UserlistHeader, UserlistSection, Value, Whitespace

Instance Method Summary collapse

Instance Method Details



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/haproxy/treetop/nodes.rb', line 218

def print_node(e, depth, options = nil)
  options ||= {}
  options = {max_depth: 2}.merge(options)

  puts if depth == 0
  print "--" * depth
  print " #{e.class.name.split("::").last}"
  print " [#{e.text_value}]" if e.class == ::Treetop::Runtime::SyntaxNode
  print " [#{e.content}]" if e.respond_to? :content
  puts
  if depth < options[:max_depth] && e.elements && !e.respond_to?(:content)
    e.elements.each do |child|
      print_node(child, depth + 1, options)
    end
  end
end