Module: WickedPdf::PdfHelper
- Defined in:
- lib/wicked_pdf/pdf_helper.rb
Class Method Summary collapse
Instance Method Summary collapse
- #render(*args) ⇒ Object
- #render_to_string(*args) ⇒ Object
- #render_to_string_with_wicked_pdf(options) ⇒ Object
- #render_with_wicked_pdf(options) ⇒ Object
Class Method Details
.prepended(base) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/wicked_pdf/pdf_helper.rb', line 5 def self.prepended(base) # Protect from trying to augment modules that appear # as the result of adding other gems. return if base != ActionController::Base base.class_eval do after_action :clean_temp_files end end |
Instance Method Details
#render(*args) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/wicked_pdf/pdf_helper.rb', line 15 def render(*args) = args.first if .is_a?(Hash) && .key?(:pdf) render_with_wicked_pdf() else super end end |
#render_to_string(*args) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/wicked_pdf/pdf_helper.rb', line 24 def render_to_string(*args) = args.first if .is_a?(Hash) && .key?(:pdf) render_to_string_with_wicked_pdf() else super end end |
#render_to_string_with_wicked_pdf(options) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/wicked_pdf/pdf_helper.rb', line 40 def render_to_string_with_wicked_pdf() raise ArgumentError, 'missing keyword: pdf' unless .is_a?(Hash) && .key?(:pdf) [:basic_auth] = set_basic_auth() .delete :pdf make_pdf((WickedPdf.config || {}).merge()) end |
#render_with_wicked_pdf(options) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/wicked_pdf/pdf_helper.rb', line 33 def render_with_wicked_pdf() raise ArgumentError, 'missing keyword: pdf' unless .is_a?(Hash) && .key?(:pdf) [:basic_auth] = set_basic_auth() make_and_send_pdf(.delete(:pdf), (WickedPdf.config || {}).merge()) end |