pdf_gem 1.0.3 → 1.0.7

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: c618dfc11c4ba373b60e66c30a723f1f45b17f9b4437e5ea2b1458ac6dd3a20a
4
- data.tar.gz: e7b54132e60927e11ecbcafe632286f86cd7b370a960b68a8a3dcbdfb392d143
3
+ metadata.gz: a4c0bda6a2f0b4e18cd46e48244daa04dc915aadd3e97fc4c610693dd6a50ad7
4
+ data.tar.gz: c3c291cb440ef39d1594485d7cb826df23fc14e60c132c3285561a209868c58b
5
5
  SHA512:
6
- metadata.gz: 2e0e27de69f25c6e63c7e672deecdcdfc13b98c5ea16008131852a9655d8fbc6a10ac933826dd3dea705bb125000abab9c3e2592e772bba10cc325e26e3617ba
7
- data.tar.gz: 513d9320d4ac3f1410cac31ed22bd84fd70bbb7464e4eb723edbd7d843fad378f58c7f0bc7d7f47004175a7e3f4349553d413126ca51bae6e634300d78bd4bfe
6
+ metadata.gz: 7fad7f3dd35e1627f48bd11a45705eb8b8b21439d0d1e1795a83530cb0ef0e45c4ca0a8fdc2cf0da8f5f3c1e0485e28c8880d739126cf059d18d0624512e7672
7
+ data.tar.gz: 9bc66a23cfcb9ccd9bede74f8f0d63988fc37d8721a90a73fbf37f484a6c127dcf892602c8d09f4aa00f5ab3feb8bc19c817b8c071fd7dab9588970d726838cc
data/README.md CHANGED
@@ -25,6 +25,15 @@ Or install it yourself as:
25
25
  $ gem install pdf_gem
26
26
  ```
27
27
 
28
+ Add this lines to `application.rb`
29
+ ```ruby
30
+ ActionController::Renderers.add :pdf do |template, options|
31
+ PdfGem.renderer(template, options)
32
+ end
33
+ ```
34
+ > **NOTE** You can change the :pdf in some other name if you have conflicts with other similar libraries
35
+
36
+
28
37
  You may need to add
29
38
  ```ruby
30
39
  Mime::Type.register "application/pdf", :pdf
@@ -1,3 +1,3 @@
1
1
  module PdfGem
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.7'
3
3
  end
data/lib/pdf_gem.rb CHANGED
@@ -16,7 +16,7 @@ module PdfGem
16
16
  end
17
17
  else
18
18
  raise stderr.present? ? stderr : "error"
19
- end
19
+ end
20
20
  end
21
21
 
22
22
  def self.pdf_from_string(params)
data/lib/renderer.rb CHANGED
@@ -1,16 +1,10 @@
1
1
  module PdfGem
2
- ActionController::Renderers.add :pdf do |template, options|
2
+ def self.renderer(template, options)
3
3
  params = options.except(:prefixes, :template, :disposition, :url, :html, :filename, :formats)
4
4
  params[:html] = render_to_string(:action => (template.present? ? template : options.template), formats: options[:formats].present? ? options[:formats] : [:pdf] )
5
5
  send_data PdfGem::pdf_from_string(params), type: Mime[:pdf], disposition: (params[:disposition].present? ? params[:disposition] : 'inline'), :filename => options[:filename]
6
6
  end
7
7
 
8
- ActionController::Renderers.add :pdf2 do |template, options|
9
- params = options.except(:prefixes, :template, :disposition, :url, :html, :filename, :formats)
10
- params[:html] = render_to_string(:action => (template.present? ? template : options.template), formats: options[:formats].present? ? options[:formats] : [:pdf] )
11
- send_data PdfGem::pdf_from_string(params), type: Mime[:pdf], disposition: (params[:disposition].present? ? params[:disposition] : 'inline'), :filename => options[:filename]
12
- end
13
-
14
8
  if Mime::Type.lookup_by_extension(:pdf).nil?
15
9
  Mime::Type.register('application/pdf', :pdf)
16
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdf_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Blasina