class CliFormat::Presenter::Json

Public Instance Methods

text() click to toggle source
# File lib/cli_format/presenter/json.rb, line 5
def text
  json_data = @rows.map do |row|
    item = {}
    @header.each_with_index do |header, i|
      item[header] = row[i]
    end
    item
  end
  JSON.pretty_generate(json_data)
end