Sha256: e932c042c7ef59ab88534867681d94b033078d824a8a0c7fc262d0b6233aa102
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
require 'uktt/export_chapter_pdf' require 'uktt/export_cover_pdf' module Uktt # An object for producing PDF files of individual chapters in the Tariff class Pdf attr_accessor :chapter_id, :config 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 def make_chapter pdf = ExportChapterPdf.new(@config.merge(chapter_id: @chapter_id)) pdf.save_as(@filepath) @filepath end def config=(new_opts = {}) merged_opts = Uktt.config.merge(new_opts) Uktt.configure merged_opts @chapter_id = merged_opts[:chapter_id] || @chapter_id @filepath = merged_opts[:filepath] || @filepath @currency = merged_opts[:currency] || @currency @config = Uktt.config end def make_cover pdf = ExportCoverPdf.new pdf.save_as(@filepath) @filepath end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
uktt-0.2.15 | lib/uktt/pdf.rb |
uktt-0.2.14 | lib/uktt/pdf.rb |