kovid 0.4.10 → 0.4.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93c6869d4d98c8b4170306fc9db05044d8aede491ff9049e9e172c1df27f99cf
4
- data.tar.gz: 4e093665a3ff1f44620f6a81af0ff755777f59570648bb0a04b0660fdfb8ff23
3
+ metadata.gz: 3d27663428f061e75f69ae9d3110bae2a421550683a98757b7500b2813cb8f65
4
+ data.tar.gz: 27c9ce9b8697d468edf40cb869ecba3a85768559626bcdad685707938a0e00a7
5
5
  SHA512:
6
- metadata.gz: 1bd2d6b4e0f1c99719f73fd54db7e3710d4cad8ed24bf1356e277473c5a9a43afead6e8fc31fce84f8dbcbaeb35c2b1b91bc77803f45d7e3ca62097b32c1ec04
7
- data.tar.gz: e2f7a810f88cd5db07215060329a1d345a89f3f6ccca7967f42a75e94b123638bc917f6494732e821e9dbd87785a7de0216eb3bafe489a214d777632f533df89
6
+ metadata.gz: f5d11f328ec94cce0e3a13cad8668bb3a6a71a19140d4f8a1ea87d981922195370a4bd8e52562ae3a67cb16903a8f46ef70afbf218bf2a7d20180a348e0580d7
7
+ data.tar.gz: 29f3629879ea3aed120c91ae16eb1366f853ef604398f17fd05e59fb4521dcd0d77aeae5f28db4d09e96b9418be93f7a0d3aa20d7bfcd391d1788565e13f81f1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kovid (0.4.9)
4
+ kovid (0.4.10)
5
5
  ascii_charts (~> 0.9.1)
6
6
  rainbow (~> 3.0)
7
7
  terminal-table (~> 1.8)
data/README.md CHANGED
@@ -65,6 +65,7 @@ ___
65
65
  #### Histogram (Experimental) 🧪
66
66
 
67
67
  `kovid histogram COUNTRY M.YY` (draws a histogram of cases in the given month `M` and years `YY`)
68
+ (If the histogram appears messy, you might want to resize your window.)
68
69
 
69
70
  #### Commands Details
70
71
  To fetch basic data on a country run:
data/lib/kovid/request.rb CHANGED
@@ -84,8 +84,11 @@ module Kovid
84
84
 
85
85
  def state(state)
86
86
  response = fetch_state(state)
87
-
88
- Kovid::Tablelize.full_state_table(response)
87
+ if response.nil?
88
+ not_found(state)
89
+ else
90
+ Kovid::Tablelize.full_state_table(response)
91
+ end
89
92
  rescue JSON::ParserError
90
93
  puts SERVER_DOWN
91
94
  end
@@ -184,12 +187,23 @@ module Kovid
184
187
  isos.include?(hash['countryInfo']['iso2'])
185
188
  end
186
189
 
187
- head, *tail = country_array
188
- data = head.merge(*tail) do |key, left, right|
189
- left ||= 0
190
- right ||= 0
190
+ # You can't do this for Ruby veresion < 2.6.0
191
+ # #merge behaviour was changed in Ruby 2.6.0
192
+ # head, *tail = country_array
193
+ # data = head.merge(*tail) do |key, left, right|
194
+ # left ||= 0
195
+ # right ||= 0
196
+
197
+ # left + right unless %w[country countryInfo].include?(key)
198
+ # end.compact
199
+
200
+ data = country_array.inject do |base, other|
201
+ base.merge(other) do |key, left, right|
202
+ left ||= 0
203
+ right ||= 0
191
204
 
192
- left + right unless %w[country countryInfo].include?(key)
205
+ left + right unless %w[country countryInfo].include?(key)
206
+ end
193
207
  end.compact
194
208
 
195
209
  meth === data
@@ -259,7 +259,7 @@ module Kovid
259
259
 
260
260
  Kovid.info_table(msgs.sample)
261
261
  else
262
- Kovid.info_table('No infections for this month.')
262
+ Kovid.info_table('Check your spelling/No infections for this month.')
263
263
  end
264
264
 
265
265
  else
data/lib/kovid/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kovid
4
- VERSION = '0.4.10'
4
+ VERSION = '0.4.11'
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.10
4
+ version: 0.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emmanuel Hayford