Class: GemCompatScan::PDFGenerator
- Inherits:
-
Object
- Object
- GemCompatScan::PDFGenerator
- Defined in:
- lib/gem_compat_scan/pdf_generator.rb
Class Method Summary collapse
- .generate_report(updates, output_path = 'gem_updates_report.pdf') ⇒ Object
- .github_link(github_url, pdf) ⇒ Object
Class Method Details
.generate_report(updates, output_path = 'gem_updates_report.pdf') ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gem_compat_scan/pdf_generator.rb', line 6 def self.generate_report(updates, output_path = 'gem_updates_report.pdf') Prawn::Document.generate(output_path) do |pdf| pdf.text 'Gem Updates Report', size: 18, style: :bold, align: :center pdf.move_down 20 table_data = [['Gem', 'Current Version', 'Latest Version', 'Github URL']] updates.each do |update| table_data << [ update[:gem], update[:current_version], update[:latest_version], github_link(update[:github_url], pdf) ] end pdf.table(table_data, header: true, width: pdf.bounds.width) do cells.borders = [] row(0).font_style = :bold end end end |
.github_link(github_url, pdf) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/gem_compat_scan/pdf_generator.rb', line 29 def self.github_link(github_url, pdf) if github_url pdf.make_cell( :content => "<link href='#{github_url}'>#{github_url}</link>", :inline_format => true) else '' end end |