Method: APISpec::Namespace#print_tree

Defined in:
lib/apispec/namespace.rb

print the structure of all namespaces



87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/apispec/namespace.rb', line 87

def print_tree(indent = 0, lines = [])
  lines << ("  " * indent) + self.to_s
  @nodes.keys.sort.each do |reference|
    node = @nodes[reference]
    if node.is_a? APISpec::Namespace
      node.print_tree(indent + 1, lines)
    else
      lines << ("  " * (indent + 1)) + "#{reference} => #{node.to_s}"
    end
  end
  lines.join("\n")
end