Module: Zendesk::Printer::Json

Defined in:
lib/zendesk/printer/json.rb

Class Method Summary collapse

Class Method Details



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/zendesk/printer/json.rb', line 8

def print(results)
  results.keys.each do |table_name|
    result = results[table_name]

    puts
    puts table_name.capitalize
    puts '_' * table_name.size
    puts

    if result.size.zero?
      puts '[No results]'
      next
    else
      result.each do |row|
        puts JSON.pretty_generate(row)
      end
    end
  end
end