Skip to content

Commit

Permalink
Fix zeitwerk issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Tapia committed Jan 29, 2024
1 parent 356ad5a commit f0d1064
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 34 deletions.
31 changes: 31 additions & 0 deletions lib/action_view/template/handlers/prawn.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# frozen_string_literal: true

require 'prawn'

module ActionView
module Template::Handlers
class Prawn
def self.register!
::ActionView::Template.register_template_handler :prawn, self
end

def self.call(template, source = template.source)
%(extend #{DocumentProxy}; #{source}; pdf.render)
end

module DocumentProxy
def pdf
@pdf ||= ::Prawn::Document.new(::Spree::PrintInvoice::Config[:prawn_options])
end

private

def method_missing(method, *args, &block)
pdf.respond_to?(method) ? pdf.send(method, *args, &block) : super
end
end
end
end
end

::ActionView::Template::Handlers::Prawn.register!
33 changes: 0 additions & 33 deletions lib/prawn_handler.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/solidus_print_invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'solidus_print_invoice/version'
require 'solidus_print_invoice/engine'

require 'prawn_handler'
require 'action_view/template/handlers/prawn'

module Spree
module PrintInvoice
Expand Down

0 comments on commit f0d1064

Please sign in to comment.