postdoc 0.2.1 → 0.2.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: 66b2bf15842d2bb088526c1d00aa1680e299aa37b0431825d60d71ce84d77b6c
4
- data.tar.gz: acc941b19fbbbddb2e0f6c84ddad1fe7576852b09eabed787063afe6b428b74c
3
+ metadata.gz: a85e6b50205b46d1127b53214c2bad5e53aef5765081e17a1998eafb7c1bae4b
4
+ data.tar.gz: 6d00e103be5c33ce38e20e0bfa3cf8939ee2a8824a9a13e32f15662fea31c0b6
5
5
  SHA512:
6
- metadata.gz: a3cc2d4563b3c660122817b3abd73897842baf84fa7cbecf4b054dc3758826fef359d68613fc10a60a5eecfcbc7a2841a3d6e89e45ee98bf050f2acd24f10783
7
- data.tar.gz: 55d531eaffa08bb24545fa3e1103d4e6377bc10f63514b3baaea8254aad04a2319a90bd0dbda66b7d56027082245d23cf3fc7e3041afd2baa7ebe67687b34b68
6
+ metadata.gz: 416f6e0522cbd000347afb73c1e66fc7ad1b054db46d0bb4ae2a3b21dfc24720b8bbdd1eca7fbe7c13860815a3916aa30e1d7d009e1f2675aca5f8c599755f7d
7
+ data.tar.gz: a5b397c41b09ddf29125eb3ddd4e967971abcabefcf3a7b57222888c827b783f6978fb14316d51170baf8c7c04b0e701c5054fdaac151438452b943552ebe5fc
data/lib/postdoc.rb CHANGED
@@ -1,18 +1,14 @@
1
- require 'postdoc/postdoc_view_helper'
2
1
  require 'chrome_remote'
3
2
 
4
3
  module Postdoc
5
-
6
- class PostdocRailtie < Rails::Railtie
7
- initializer 'postdoc.register' do |_app|
8
- ActionView::Base.send :include, PostdocViewHelper
9
- end
4
+ ActionController::Renderers.add :pdf do |filename, options|
5
+ render_from_string_to_pdf render_to_string(options), options
10
6
  end
11
7
 
12
- ActionController::Renderers.add :pdf do |filename, options|
8
+ def self.render_from_string(string, options)
13
9
  htmlfile = Tempfile.new ['input', '.html']
14
10
 
15
- htmlfile.write render_to_string(options)
11
+ htmlfile.write string
16
12
  htmlfile.flush
17
13
 
18
14
  # random port at 1025 or higher
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Groeneveld
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-06 00:00:00.000000000 Z
11
+ date: 2019-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -54,7 +54,6 @@ files:
54
54
  - LICENSE
55
55
  - Rakefile
56
56
  - lib/postdoc.rb
57
- - lib/postdoc/postdoc_view_helper.rb
58
57
  homepage: https://github.com/ivaldi/postdoc
59
58
  licenses:
60
59
  - BSD-2-Clause
@@ -1,23 +0,0 @@
1
- module PostdocViewHelper
2
- def postdoc_stylesheet_link_tag(path)
3
- content_tag :style, read_asset(path), type: 'text/css'
4
- end
5
-
6
- def postdoc_javascript_include_tag(path)
7
- content_tag :script, read_asset(path), type: 'text/javascript'
8
- end
9
-
10
- def postdoc_image_tag(path, options = {})
11
- image_tag asset_path(path), options
12
- end
13
-
14
- protected
15
-
16
- def read_asset(path)
17
- Rails.application.assets.find_asset(path).to_s.html_safe
18
- end
19
-
20
- def asset_path(path)
21
- Rails.application.assets.find_asset(path).filename
22
- end
23
- end