module RubyDanfe
encoding: utf-8
Constants
- VERSION
Public Class Methods
generate(pdf_filename, xml_filename, type = :danfe, new_options = {})
click to toggle source
# File lib/ruby_danfe/ruby_danfe.rb, line 3 def self.generate(pdf_filename, xml_filename, type = :danfe, new_options = {}) self.options = new_options if !new_options.empty? xml_string = File.new(xml_filename) render_file(pdf_filename, xml_string, type) end
options()
click to toggle source
# File lib/ruby_danfe/ruby_danfe.rb, line 24 def self.options @options ||= RubyDanfe::Options.new end
options=(new_options = {})
click to toggle source
# File lib/ruby_danfe/ruby_danfe.rb, line 28 def self.options=(new_options = {}) @options = RubyDanfe::Options.new(new_options) end
render(xml_string, type = :danfe, new_options = {})
click to toggle source
# File lib/ruby_danfe/ruby_danfe.rb, line 10 def self.render(xml_string, type = :danfe, new_options = {}) self.options = new_options if !new_options.empty? pdf = generatePDF(xml_string, type) pdf.render end
render_file(pdf_filename, xml_string, type = :danfe, new_options = {})
click to toggle source
# File lib/ruby_danfe/ruby_danfe.rb, line 17 def self.render_file(pdf_filename, xml_string, type = :danfe, new_options = {}) self.options = new_options if !new_options.empty? pdf = generatePDF(xml_string, type) pdf.render_file pdf_filename end
Private Class Methods
generatePDF(xml_string, type = :danfe, new_options = {})
click to toggle source
# File lib/ruby_danfe/ruby_danfe.rb, line 33 def self.generatePDF(xml_string, type = :danfe, new_options = {}) self.options = new_options if !new_options.empty? xml = XML.new(xml_string) generator = case type when :danfe then DanfeGenerator.new(xml) when :danfe_nfce then DanfeNfceGenerator.new(xml) when :dacte then DacteGenerator.new(xml) when :danfse then DanfseGenerator.new(xml) when :dacteos then DacteosGenerator.new(xml) else raise "unknown type #{type}" end generator.generatePDF end