Class: BreezyPDF::HTML::Publicize
- Inherits:
-
Object
- Object
- BreezyPDF::HTML::Publicize
- Defined in:
- lib/breezy_pdf/html/publicize.rb
Overview
Replace assets with uploaded URL’s
Instance Method Summary collapse
-
#initialize(base_url, html_fragment) ⇒ Publicize
constructor
A new instance of Publicize.
- #public_fragment ⇒ Object
- #timing ⇒ Object
- #upload_ids ⇒ Object
Constructor Details
#initialize(base_url, html_fragment) ⇒ Publicize
Returns a new instance of Publicize.
6 7 8 9 10 11 12 |
# File 'lib/breezy_pdf/html/publicize.rb', line 6 def initialize(base_url, html_fragment) @base_url = base_url @html_fragment = html_fragment @log_queue = [] @upload_ids = [] @start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) end |
Instance Method Details
#public_fragment ⇒ Object
14 15 16 17 18 19 |
# File 'lib/breezy_pdf/html/publicize.rb', line 14 def public_fragment @public_fragment ||= parsed_document.tap do publicize! BreezyPDF.logger.info("[BreezyPDF] Replaced assets in #{timing} seconds") end.to_html end |
#timing ⇒ Object
27 28 29 |
# File 'lib/breezy_pdf/html/publicize.rb', line 27 def timing @timing ||= Process.clock_gettime(Process::CLOCK_MONOTONIC) - @start_time end |
#upload_ids ⇒ Object
21 22 23 24 25 |
# File 'lib/breezy_pdf/html/publicize.rb', line 21 def upload_ids public_fragment @upload_ids end |