Class: CovidPT::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/covid_pt/report.rb

Constant Summary collapse

MUNICIPALITY_EDGE_CASES =
{
  "Monsaraz" => "Reguengos de Monsaraz",
  "Graciosa" => "Santa Cruz da Graciosa",
  "Penaguião" => "Santa Marta de Penaguião",
  "António" => "Vila Real de Santo António",
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(date) ⇒ Report

Returns a new instance of Report.



14
15
16
17
18
19
# File 'lib/covid_pt/report.rb', line 14

def initialize(date)
  @date = Date.parse(date)
rescue ArgumentError => e
  puts e.message
  puts "Argument: #{date}"
end

Instance Method Details

#generateObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/covid_pt/report.rb', line 21

def generate
  return @report if @report

  @report = {
    overall: overall_report,
    regional: regional_report,
    date: @date
  }

  cleanup

  @report
end