|node| node[1] if node[0] == :var_decl end.compact end ast.each do |node| next unless node[0] == :class_decl puts "class: #{node[1]}" properties(node).each do |p| puts " -> #{p}" end end https://github.com/AlexDenisov/mbx/blob/master/dump_classes_swift.rb