Class: Kovid::CLI
- Inherits:
-
Thor
- Object
- Thor
- Kovid::CLI
- Defined in:
- lib/kovid/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
- #africa ⇒ Object
- #asia ⇒ Object
- #check(*name) ⇒ Object
- #compare(*_name) ⇒ Object
- #eu ⇒ Object
- #europe ⇒ Object
- #histogram(country, date = nil) ⇒ Object
- #history(location, days = 30) ⇒ Object
- #province(name) ⇒ Object
- #provinces(*names) ⇒ Object
- #sa ⇒ Object
- #state(state) ⇒ Object
- #states(*states) ⇒ Object
- #top(count = 5) ⇒ Object
- #version ⇒ Object
- #world ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
8 9 10 |
# File 'lib/kovid/cli.rb', line 8 def self.exit_on_failure? true end |
Instance Method Details
#africa ⇒ Object
104 105 106 107 |
# File 'lib/kovid/cli.rb', line 104 def africa puts Kovid.africa_aggregate data_source end |
#asia ⇒ Object
116 117 118 119 |
# File 'lib/kovid/cli.rb', line 116 def asia puts Kovid.asia_aggregate data_source end |
#check(*name) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/kovid/cli.rb', line 33 def check(*name) if name.size == 1 fetch_country_stats(name.pop) elsif [:full] puts Kovid.country_comparison_full(name) else puts Kovid.country_comparison(name) end data_source end |
#compare(*_name) ⇒ Object
46 47 48 49 |
# File 'lib/kovid/cli.rb', line 46 def compare(*_name) Kovid.info_table("#compare is deprecated and will be removed in v7.0.0. \ \nPlease do `kovid check COUNTRY COUNTRY ...` instead.") end |
#eu ⇒ Object
92 93 94 95 |
# File 'lib/kovid/cli.rb', line 92 def eu puts Kovid.eu_aggregate data_source end |
#europe ⇒ Object
98 99 100 101 |
# File 'lib/kovid/cli.rb', line 98 def europe puts Kovid.europe_aggregate data_source end |
#histogram(country, date = nil) ⇒ Object
127 128 129 130 131 132 133 134 |
# File 'lib/kovid/cli.rb', line 127 def histogram(country, date = nil) if date.nil? Kovid.info_table("Please add a month and year in the form 'M.YY'") else puts Kovid.histogram(country, date) data_source end end |
#history(location, days = 30) ⇒ Object
82 83 84 85 86 87 88 89 |
# File 'lib/kovid/cli.rb', line 82 def history(location, days = 30) if [:usa] puts Kovid.history_us_state(location, days) else puts Kovid.history(location, days) end data_source end |
#province(name) ⇒ Object
16 17 18 19 |
# File 'lib/kovid/cli.rb', line 16 def province(name) puts Kovid.province(name) data_source end |
#provinces(*names) ⇒ Object
24 25 26 27 |
# File 'lib/kovid/cli.rb', line 24 def provinces(*names) puts Kovid.provinces(names) data_source end |
#sa ⇒ Object
110 111 112 113 |
# File 'lib/kovid/cli.rb', line 110 def sa puts Kovid.south_america_aggregate data_source end |
#state(state) ⇒ Object
52 53 54 55 |
# File 'lib/kovid/cli.rb', line 52 def state(state) puts Kovid.state(state) data_source end |
#states(*states) ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/kovid/cli.rb', line 61 def states(*states) if [:all] puts Kovid.all_us_states else downcased_states = states.map(&:downcase) puts Kovid.states(downcased_states) end data_source end |
#top(count = 5) ⇒ Object
143 144 145 146 147 148 |
# File 'lib/kovid/cli.rb', line 143 def top(count = 5) count = count.to_i count = 5 if count.zero? puts Kovid.top(count, prepare_top_params()) data_source end |