grover 0.6.1 → 0.6.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
  SHA1:
3
- metadata.gz: 6c26dbbef85a97e2a0efaaac225c73ef4621c3a2
4
- data.tar.gz: 644ba163ea5e742ae0f9b245ed1d5a7381968865
3
+ metadata.gz: 1062c1738a1216a3c8fb5907b1abcb5abee7ef4e
4
+ data.tar.gz: 7a6aea69f2eaa43d30f0c126f0baea36c3b70470
5
5
  SHA512:
6
- metadata.gz: 6eb0f8320d0fe7d53c13b9474a014cc9ab1fab300d70ef15c8dae1d6dfd45569005a3073f5339882b28898d6d297b26329c28a152dd9ae6a709bfc9e6de31d5d
7
- data.tar.gz: 8135ebc0aae3ba810577be644f2efd184d799f79c943dd8c07d431eb9d1e8fb8eff8fa5a2b3277b17c01cd7554de907abd4b0570304588c99ac55c6782f87eb5
6
+ metadata.gz: 3824873485392bc39b03509cd88f296555aaea0984eaff8158be31bee78fc282d790d86cb988bf05eac1035a866d0306131fd31dd4d67fdca0157e3e241e3721
7
+ data.tar.gz: 7f2ce9086e1206c2464232f80893b7098272737cb74398299514b6c8ed2f817e4485706965f73f858ac0f5e13c10b58653d84b1d574042b76225da0a954d08bd
@@ -6,9 +6,7 @@ class Grover
6
6
  attr_accessor :options, :meta_tag_prefix
7
7
 
8
8
  def initialize
9
- @options = {
10
- cache: false
11
- }
9
+ @options = {}
12
10
  @meta_tag_prefix = 'grover-'
13
11
  end
14
12
  end
@@ -15,9 +15,9 @@ class Grover
15
15
 
16
16
  def call(env)
17
17
  @request = Rack::Request.new(env)
18
- @render_pdf = false
18
+ @render_pdf = pdf_request?
19
19
 
20
- configure_env_for_pdf_request(env) if render_as_pdf?
20
+ configure_env_for_pdf_request(env) if rendering_pdf?
21
21
  status, headers, response = @app.call(env)
22
22
 
23
23
  if rendering_pdf? && html_content?(headers)
@@ -37,7 +37,7 @@ class Grover
37
37
  @render_pdf
38
38
  end
39
39
 
40
- def render_as_pdf?
40
+ def pdf_request?
41
41
  !@request.path.match(PDF_REGEX).nil?
42
42
  end
43
43
 
@@ -59,7 +59,7 @@ class Grover
59
59
  body = body.join if body.is_a?(Array)
60
60
 
61
61
  body = HTMLPreprocessor.process body, root_url, protocol
62
- Grover.new(body, display_url: request_url, cache: false)
62
+ Grover.new(body, display_url: request_url)
63
63
  end
64
64
 
65
65
  def add_cover_content(grover)
@@ -88,10 +88,7 @@ class Grover
88
88
  end
89
89
 
90
90
  def configure_env_for_pdf_request(env)
91
- @render_pdf = true
92
-
93
- env['PATH_INFO'] = path_without_extension
94
- env['REQUEST_URI'] = path_without_extension
91
+ env['PATH_INFO'] = env['REQUEST_URI'] = path_without_extension
95
92
  env['HTTP_ACCEPT'] = concat(env['HTTP_ACCEPT'], Rack::Mime.mime_type('.html'))
96
93
  env['Rack-Middleware-Grover'] = 'true'
97
94
  end
@@ -109,10 +106,7 @@ class Grover
109
106
  end
110
107
 
111
108
  def path_without_extension
112
- return @path_without_extension if defined? @path_without_extension
113
-
114
- path = @request.path.sub(PDF_REGEX, '')
115
- @path_without_extension = path.sub(@request.script_name, '')
109
+ @request.path.sub(PDF_REGEX, '').sub(@request.script_name, '')
116
110
  end
117
111
 
118
112
  def request_url
@@ -1,3 +1,3 @@
1
1
  class Grover
2
- VERSION = '0.6.1'.freeze
2
+ VERSION = '0.6.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bromwich