Class: PdfRenderer

Inherits:
Object
  • Object
show all
Defined in:
app/services/pdf_renderer.rb

Overview

This class simply encapsulates a standard server side renderer
that can be used with pdf generation

Instance Method Summary collapse

Constructor Details

#initializePdfRenderer

Returns a new instance of PdfRenderer.



5
# File 'app/services/pdf_renderer.rb', line 5

def initialize; end

Instance Method Details

#render(options) ⇒ String

Renders a template to one or more output formats.

Parameters:

  • options (Hash)

    Options hash forwarded to ApplicationController.render

Options Hash (options):

  • :formats (Array<Symbol>)

    output formats to render (defaults to [:html])

Returns:

  • (String)

    the rendered output



11
12
13
14
15
16
# File 'app/services/pdf_renderer.rb', line 11

def render(options)
  if options[:formats].blank?
    options[:formats] = %i[html] # Sensible default
  end
  ApplicationController.render(options)
end