Class: Commento::Report

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

Direct Known Subclasses

Commento::Reports::Html

Constant Summary collapse

COMMENTO_FOLDER_NAME =
'commento'

Instance Method Summary collapse

Constructor Details

#initialize(data_scraper: Commento::Scrapers::Ruby.new) ⇒ Report

Returns a new instance of Report.



7
8
9
# File 'lib/commento/report.rb', line 7

def initialize(data_scraper: Commento::Scrapers::Ruby.new)
  @data_scraper = data_scraper
end

Instance Method Details

#create_reportObject



11
12
13
14
15
16
17
18
# File 'lib/commento/report.rb', line 11

def create_report
  @commento_data = @data_scraper.call
  FileUtils.mkdir_p(COMMENTO_FOLDER_NAME)
  File.write(
    "#{COMMENTO_FOLDER_NAME}/#{file_name}",
    main_template.gsub('%tables_placeholder%', tables_placeholder)
  )
end