kovid 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/kovid/tablelize.rb +20 -17
- data/lib/kovid/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e2bcf9cae235b902baf6388bd509cf8bb7b9445b2bac741713c6f1d60ca830fc
|
|
4
|
+
data.tar.gz: 91d40e2882577373c5336057dd3a235364b924e276550662bd806075f90e90cc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: be7fe0fe2d21b477994aa531636b0dde19b350ca3a53e3c985cbe13d9dee5285c32e580bc893877c05599290471aeb7835b5d8a520f1fd8f3ceb0cfae5f3eed6
|
|
7
|
+
data.tar.gz: 45d45c55e305c76a2393580965cecb39e5227e1d2a8bba8a1ac335524f5535eddd099e13096d2d58e204ee84b40933b27bc5c6fdcbd316154940349bfca5e335
|
data/Gemfile.lock
CHANGED
data/lib/kovid/tablelize.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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:
|
|
151
|
+
Terminal::Table.new(headings: COMPARE_COUNTRIES_TABLE_HEADINGS, rows: rows)
|
|
149
152
|
end
|
|
150
153
|
|
|
151
154
|
def compare_countries_table_full(data)
|
data/lib/kovid/version.rb
CHANGED