Class: Uktt::Pdf
- Inherits:
-
Object
- Object
- Uktt::Pdf
- Defined in:
- lib/uktt/pdf.rb
Overview
An object for producing PDF files of individual chapters in the Tariff
Instance Attribute Summary collapse
-
#chapter_id ⇒ Object
Returns the value of attribute chapter_id.
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Pdf
constructor
A new instance of Pdf.
- #make_chapter ⇒ Object
- #make_cover ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Pdf
Returns a new instance of Pdf.
9 10 11 12 13 14 15 |
# File 'lib/uktt/pdf.rb', line 9 def initialize(opts = {}) @chapter_id = opts[:chapter_id] || nil @filepath = opts[:filepath] || "#{Dir.pwd}/#{@chapter_id || 'cover'}.pdf" @currency = opts[:currency] || Uktt::PARENT_CURRENCY Uktt.configure(opts) @config = Uktt.config end |
Instance Attribute Details
#chapter_id ⇒ Object
Returns the value of attribute chapter_id.
7 8 9 |
# File 'lib/uktt/pdf.rb', line 7 def chapter_id @chapter_id end |
#config ⇒ Object
Returns the value of attribute config.
7 8 9 |
# File 'lib/uktt/pdf.rb', line 7 def config @config end |
Instance Method Details
#make_chapter ⇒ Object
17 18 19 20 21 |
# File 'lib/uktt/pdf.rb', line 17 def make_chapter pdf = ExportChapterPdf.new(@config.merge(chapter_id: @chapter_id)) pdf.save_as(@filepath) @filepath end |
#make_cover ⇒ Object
32 33 34 35 36 |
# File 'lib/uktt/pdf.rb', line 32 def make_cover pdf = ExportCoverPdf.new pdf.save_as(@filepath) @filepath end |