kovid 0.2.8 → 0.3.0
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/cli.rb +9 -1
- data/lib/kovid/tablelize.rb +14 -8
- 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: fa7abbc0a4d9eca2bbc865fd6740fdf7ae611ec5290cf96e6ce28248982f2f00
|
4
|
+
data.tar.gz: 51ad886114e16c076fca34b96e4bd92c30022eb0a5fcff2e4a20eb067f688e8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93ac6304f8fcbf01b071e0be5dbf39d8a717d2fb9449f5851abe60f2ece6b17d541828817cbe42ede1cec787018c32f000a410287ee5ed3987d74a41ddcf43f3
|
7
|
+
data.tar.gz: 5cbe6f55009cb9a8af32a16a98739cf6df669218e903684232e86a58372c29fdd70c5d3ae2102228449c4e85157e58f02c31971a9f158375e17ee06cd389864f
|
data/Gemfile.lock
CHANGED
data/lib/kovid/cli.rb
CHANGED
@@ -21,8 +21,16 @@ module Kovid
|
|
21
21
|
puts Kovid.country(name)
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
24
25
|
desc 'country COUNTRY or country "COUNTRY NAME"', 'Returns reported data on provided country. eg: "kovid country "hong kong".'
|
25
|
-
|
26
|
+
method_option :full, aliases: '-f'
|
27
|
+
def country(name)
|
28
|
+
if options[:full]
|
29
|
+
puts Kovid.country_full(name)
|
30
|
+
else
|
31
|
+
puts Kovid.country(name)
|
32
|
+
end
|
33
|
+
end
|
26
34
|
|
27
35
|
desc 'state STATE', 'Return reported data on provided state.'
|
28
36
|
def state(state)
|
data/lib/kovid/tablelize.rb
CHANGED
@@ -96,7 +96,7 @@ module Kovid
|
|
96
96
|
rows = []
|
97
97
|
|
98
98
|
data.each do |country|
|
99
|
-
rows << [country['country'].upcase, country['cases'], country['deaths'], country['recovered']]
|
99
|
+
rows << [country['country'].upcase, comma_delimit(country['cases']), comma_delimit(country['deaths']), comma_delimit(country['recovered'])]
|
100
100
|
end
|
101
101
|
|
102
102
|
Terminal::Table.new(headings: headings, rows: rows)
|
@@ -119,13 +119,13 @@ module Kovid
|
|
119
119
|
data.each do |country|
|
120
120
|
rows << [
|
121
121
|
country['country'],
|
122
|
-
country['cases'],
|
123
|
-
country['deaths'],
|
124
|
-
country['recovered'],
|
122
|
+
comma_delimit(country['cases']),
|
123
|
+
comma_delimit(country['deaths']),
|
124
|
+
comma_delimit(country['recovered']),
|
125
125
|
check_if_positve(country['todayCases']),
|
126
126
|
check_if_positve(country['todayDeaths']),
|
127
|
-
country['critical'],
|
128
|
-
country['casesPerOneMillion']
|
127
|
+
comma_delimit(country['critical']),
|
128
|
+
comma_delimit(country['casesPerOneMillion'])
|
129
129
|
]
|
130
130
|
end
|
131
131
|
|
@@ -134,7 +134,13 @@ module Kovid
|
|
134
134
|
|
135
135
|
def cases(cases)
|
136
136
|
headings = CASES_DEATHS_RECOVERED
|
137
|
-
rows = [
|
137
|
+
rows = [
|
138
|
+
[
|
139
|
+
comma_delimit(cases['cases']),
|
140
|
+
comma_delimit(cases['deaths']),
|
141
|
+
comma_delimit(cases['recovered'])
|
142
|
+
]
|
143
|
+
]
|
138
144
|
|
139
145
|
Terminal::Table.new(title: 'Total Number of Incidents Worldwide'.upcase, headings: headings, rows: rows)
|
140
146
|
end
|
@@ -180,7 +186,7 @@ module Kovid
|
|
180
186
|
end
|
181
187
|
|
182
188
|
def check_if_positve(num)
|
183
|
-
num.to_i.positive? ? "+#{num}" : num.to_s
|
189
|
+
num.to_i.positive? ? "+#{comma_delimit(num)}" : comma_delimit(num).to_s
|
184
190
|
end
|
185
191
|
|
186
192
|
def country_emoji(iso)
|
data/lib/kovid/version.rb
CHANGED