ferrum_pdf 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b709d6f3d6b9472b389f08891e3ec59f90a2e0a962f034acd31a2ee4efdb79c
4
- data.tar.gz: c1353b79300829afd212880fbcb76633e3fe7da2c2facc3b96d8305a7c5fc6ae
3
+ metadata.gz: 1bb953e452513432ae962fdf430ca58dfda05c95ef099a3a081c280aad8b7013
4
+ data.tar.gz: 8eea8b0b4b4fdcd2f24c36f7da512742c1d84efca70585cefbc23207e3287a68
5
5
  SHA512:
6
- metadata.gz: a4145a37dc89ac2dbaeb0512fffafbd6056291e0521734ed57affd66a45d32489fd412d0f8fbbde7b53046ffbc8d030f602ee6914224ea76bdb1e95c78adf50f
7
- data.tar.gz: 57c44da1352bac877910af6193f7104da77580bd9edaafa1d3dbbb4faa2175d8ec05215bccc40c7f85fa4e93d84089f15c1e2c606bcf886a46625f3c2b3ba61a
6
+ metadata.gz: b1159b7493ae224c5c2eede63d2d0e4b30b51fb33929572ed1315bc5ca59aa2f39c1778a8a12ddc8df7d7d85e0038961250c0e9073300988055e5d0be032ddfd
7
+ data.tar.gz: 93823c9ad5df71ffae73925c09af0bed905ec64a6192d249d9d733075e0e92bc7126aede0b952a2293dc708123a6d93c0e9c5f5399954a3bd9baf447815bdc5b
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # FerrumPdf
1
+ # 📄 FerrumPdf
2
2
 
3
3
  PDFs & screentshots for Rails using [Ferrum](https://github.com/rubycdp/ferrum) & headless Chrome.
4
4
 
5
- Inspired by [Grover](https://github.com/Studiosity/grover).
5
+ Inspired by [Grover](https://github.com/Studiosity/grover), but without the Node.js and puppeteer dependencies. 🎉
6
6
 
7
7
  ## Installation
8
8
 
@@ -9,6 +9,8 @@ module FerrumPdf
9
9
  # process("Some HTML", "https://example.org")
10
10
  #
11
11
  def self.process(html, base_url)
12
+ return html if base_url.blank?
13
+
12
14
  base_url += "/" unless base_url.end_with? "/"
13
15
  protocol = base_url.split("://").first
14
16
  html = translate_relative_paths(html, base_url) if base_url
@@ -1,3 +1,3 @@
1
1
  module FerrumPdf
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.2"
3
3
  end
data/lib/ferrum_pdf.rb CHANGED
@@ -25,7 +25,10 @@ module FerrumPdf
25
25
  yield config
26
26
  end
27
27
 
28
+ # Creates and registers a new browser for exports
29
+ # If a browser with the same name already exists, it will be shut down before instantiating the new one
28
30
  def add_browser(name, **options)
31
+ @@browsers[name].quit if @@browsers[name]
29
32
  @@browsers[name] = Ferrum::Browser.new(@@config.merge(options))
30
33
  end
31
34
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ferrum_pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver