Sha256: d57164f146f64c9fd248da24891bd855bcee45a996356dbfd58c8b06cb60d710
Contents?: true
Size: 928 Bytes
Versions: 2
Compression:
Stored size: 928 Bytes
Contents
# frozen_string_literal: true require 'terminal-table' module Kovid class Tablelize def self.country_table(data) rows = [] rows << [data['cases'], data['deaths'], data['recovered']] puts Terminal::Table.new(title: data['country'], headings: %w[Cases Deaths Recovered], rows: rows) end def self.full_country_table(data) headings = [ 'Cases', 'Deaths', 'Recovered', 'Cases Today', 'Deaths Today', 'Critical', 'Cases/Million' ] rows = [] rows << [ data['cases'], data['deaths'], data['recovered'], data['todayCases'], data['todayDeaths'], data['critical'], data['casesPerOneMillion'] ] puts Terminal::Table.new(title: data['country'], headings: headings, rows: rows) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kovid-0.1.2 | lib/kovid/tablelize.rb |
kovid-0.1.1 | lib/kovid/tablelize.rb |