Sha256: 5d294351f30a1bb9d6f17cc75b2cf9e032415b0aa79c093f632caf5b1b85cf7a
Contents?: true
Size: 977 Bytes
Versions: 5
Compression:
Stored size: 977 Bytes
Contents
require 'ox' require 'prawn' require 'prawn/table' require 'chunky_png' require 'rqrcode' require 'barby' require 'barby/barcode/code_128' require 'barby/outputter/png_outputter' require 'barby/outputter/prawn_outputter' require 'br_invoices_pdf/version' require 'br_invoices_pdf/generator' require 'br_invoices_pdf/errors/invalid_document_type' module BrInvoicesPdf @generators = {} module_function def generate(type, xml, options = {}) generator = @generators[type] raise(Errors::InvalidDocumentType, type) unless generator generator.generate(xml, options) end def register(type, renderer, parser) raise(ArgumentError, "Expected Symbol or String to type. Received #{type.class}") unless valid_type?(type) @generators[type.to_sym] = Generator.new(renderer, parser) end def supported_document_types @generators.keys end def valid_type?(type) type.is_a?(String) || type.is_a?(Symbol) end end require 'br_invoices_pdf/cfe'
Version data entries
5 entries across 5 versions & 1 rubygems