Class: Prawntocat::PDF

Inherits:
Object
  • Object
show all
Defined in:
lib/prawntocat/pdf.rb

Instance Method Summary collapse

Constructor Details

#initialize(repo, pdf_name) ⇒ PDF

Returns a new instance of PDF.



6
7
8
9
# File 'lib/prawntocat/pdf.rb', line 6

def initialize repo, pdf_name
  @repo = repo
  @pdf_name = pdf_name || repo.gsub("/", "_").+(".pdf")
end

Instance Method Details

#generateObject



15
16
17
18
19
20
21
22
23
# File 'lib/prawntocat/pdf.rb', line 15

def generate
  Prawn::Document.generate(@pdf_name) do |doc|
    doc.text("Issues for #{@repo}", size: 20)
    doc.move_down 20
    issues.each do |issue|
      doc.text("#{issue.title}\n", :style => :bold)
    end
  end
end

#issuesObject



11
12
13
# File 'lib/prawntocat/pdf.rb', line 11

def issues
  @issues ||= Prawntocat::Issues.new(@repo)
end