kovid 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc2e30c94c8148c8849241849c6b0340429f0a271ade0927091098972e4fc914
4
- data.tar.gz: 54197f1917738844f1c36e3c1f513deb254d5e47ecb97e8b62db198fded53935
3
+ metadata.gz: e2bcf9cae235b902baf6388bd509cf8bb7b9445b2bac741713c6f1d60ca830fc
4
+ data.tar.gz: 91d40e2882577373c5336057dd3a235364b924e276550662bd806075f90e90cc
5
5
  SHA512:
6
- metadata.gz: 2ebeeeccb550b36ecd7376ba78894434eb2b980c2dbd57e6552e8037400694cf548926e8eea642c0929f974522220804c0a4092344f9f5122df8a5ff257a3695
7
- data.tar.gz: 4f423a115a7c06d937960085e795bb77196f4513434951f1cdf01a3b41ad7892ea561eea73e8046a67a84ff47c4d497b530b08c607af783ddd4e421708091d18
6
+ metadata.gz: be7fe0fe2d21b477994aa531636b0dde19b350ca3a53e3c985cbe13d9dee5285c32e580bc893877c05599290471aeb7835b5d8a520f1fd8f3ceb0cfae5f3eed6
7
+ data.tar.gz: 45d45c55e305c76a2393580965cecb39e5227e1d2a8bba8a1ac335524f5535eddd099e13096d2d58e204ee84b40933b27bc5c6fdcbd316154940349bfca5e335
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kovid (0.4.2)
4
+ kovid (0.4.3)
5
5
  ascii_charts (~> 0.9.1)
6
6
  rainbow (~> 3.0)
7
7
  terminal-table (~> 1.8)
@@ -49,6 +49,15 @@ module Kovid
49
49
  'Cases/Million'.paint_white
50
50
  ].freeze
51
51
 
52
+ COMPARE_COUNTRIES_TABLE_HEADINGS = [
53
+ 'Country'.paint_white,
54
+ 'Cases'.paint_white,
55
+ 'Cases Today'.paint_white,
56
+ 'Deaths'.paint_red,
57
+ 'Deaths Today'.paint_red,
58
+ 'Recovered'.paint_green
59
+ ].freeze
60
+
52
61
  FOOTER_LINE = ['------------', '------------', '------------'].freeze
53
62
  COUNTRY_LETTERS = 'A'.upto('Z').with_index(127_462).to_h.freeze
54
63
 
@@ -69,8 +78,6 @@ module Kovid
69
78
  else
70
79
  Terminal::Table.new(title: data['country'].upcase, headings: headings, rows: rows)
71
80
  end
72
- # TODO: Rafactor this
73
- # TODO: Fix emoji
74
81
  end
75
82
 
76
83
  def full_country_table(data)
@@ -123,29 +130,25 @@ module Kovid
123
130
  end
124
131
 
125
132
  def compare_countries_table(data)
126
- headings = [
127
- 'Country'.paint_white,
128
- 'Cases'.paint_white,
129
- 'Deaths'.paint_red,
130
- 'Recovered'.paint_green,
131
- 'Cases Today'.paint_white,
132
- 'Deaths Today'.paint_red
133
- ]
134
-
135
133
  rows = []
136
134
 
137
135
  data.each do |country|
138
- rows << [
139
- country['country'].upcase,
136
+ base_rows = [
140
137
  comma_delimit(country['cases']),
141
- comma_delimit(country['deaths']),
142
- comma_delimit(country['recovered']),
143
138
  check_if_positve(country['todayCases']),
144
- check_if_positve(country['todayDeaths'])
139
+ comma_delimit(country['deaths']),
140
+ check_if_positve(country['todayDeaths']),
141
+ comma_delimit(country['recovered'])
145
142
  ]
143
+
144
+ rows << if iso = country['countryInfo']['iso2']
145
+ base_rows.unshift("#{country_emoji(iso)} #{country['country'].upcase}")
146
+ else
147
+ base_rows.unshift(country['country'].upcase.to_s)
148
+ end
146
149
  end
147
150
 
148
- Terminal::Table.new(headings: headings, rows: rows)
151
+ Terminal::Table.new(headings: COMPARE_COUNTRIES_TABLE_HEADINGS, rows: rows)
149
152
  end
150
153
 
151
154
  def compare_countries_table_full(data)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kovid
4
- VERSION = '0.4.3'
4
+ VERSION = '0.4.4'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kovid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emmanuel Hayford