Class: Bidi2pdfRails::Services::HtmlOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/bidi2pdf_rails/services/html_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(html_options, pdf_options, controller) ⇒ HtmlOptions

Returns a new instance of HtmlOptions.



8
9
10
11
12
# File 'lib/bidi2pdf_rails/services/html_options.rb', line 8

def initialize(html_options, pdf_options, controller)
  @html_options = html_options
  @pdf_options = pdf_options
  @controller = controller
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



6
7
8
# File 'lib/bidi2pdf_rails/services/html_options.rb', line 6

def controller
  @controller
end

#html_optionsObject (readonly)

Returns the value of attribute html_options.



6
7
8
# File 'lib/bidi2pdf_rails/services/html_options.rb', line 6

def html_options
  @html_options
end

#pdf_optionsObject (readonly)

Returns the value of attribute pdf_options.



6
7
8
# File 'lib/bidi2pdf_rails/services/html_options.rb', line 6

def pdf_options
  @pdf_options
end

Instance Method Details

#asset_hostObject



14
15
16
# File 'lib/bidi2pdf_rails/services/html_options.rb', line 14

def asset_host
  html_options.fetch(:asset_host) { |_key| pdf_options.asset_host }
end

#htmlObject



18
19
20
# File 'lib/bidi2pdf_rails/services/html_options.rb', line 18

def html
  html_options.fetch(:inline) { |_key| HtmlRenderer.new(controller, html_options.merge({ asset_host: asset_host })).render }
end