grape_cache 0.2.1 → 0.2.4

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDVmYWZjYTBkZmZiNDRiMTk0M2M2NDkyZGU4MTc5NjIzM2RjZTNkYg==
4
+ YWNiN2ZlZTRkZDU3YzI2N2RmODc1ZjBkOTBhYjA5NmYwOWRkNGE2NA==
5
5
  data.tar.gz: !binary |-
6
- NTlmOTY1YThlY2NkNzc4MzExOTI1ZWJlY2IxMjgzMjk1YjhkYzNjOQ==
6
+ NjU2MzAwMGQ5MjY5ZDM0ODVkYzY5Yzg4MzQ5YWRmMjZiZWQ0ODczMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Yzg4YzY3MjFjZDRmMmM0NWY3OWNkM2VlY2MxYWM5YjE3N2ZlODg4ZmE0YmU3
10
- MzViNjkwZWI3M2Q1YmMwOTZlNmJiMzk0NDM0YzIwYzAxM2YwNGNlNDAwNWVk
11
- NjQzMWQ2ZDIyNGMzN2NlMzRjMDM2NzZhNWM0OWNkMWNmZGVlZWY=
9
+ OWZkOTgxYzQ4M2EzYjA5NTE3MGI4YTkzNTNjMjU0NzY0MDk5ZmVmYjkwOTll
10
+ NmJmZmJiODI1MGVmNGVmZmM4OWFlMjhhZDM1ODgwNTJiNDFjZDM5ZjBlMWRi
11
+ YTdiMjJkMjViZmM3YzExYzM0MzdmODA1NjkxN2U4NDdkOTk5Y2Q=
12
12
  data.tar.gz: !binary |-
13
- N2RmYWI2MzhmNzQ1YmY3MTQ2ZjM1NDRhNTM4NDQ2YjI1NzFhNWRiNzA1Njhj
14
- NWIwM2I5NDM5YmU1ZDA0MGQ0MzI5NzUxMTI4YWRjOWM5ZTU4M2U0MzQwZGVl
15
- N2Q2MzcxNmFkYmI2YTYyNmE2NmI1ODY2OTcyYjg5YmRmMWIwZjg=
13
+ MTE1MGU0MTk3MzE4MWEyNjg3NWI4MGIyOGM1YjkzNDJjZTYwYzdhZjM5OWUw
14
+ OTM1Mzk4MmU4ZGZmZjc4ZmNjMTU3NTE1NjdkMWYwMmJhOGUwZDJhNTYyODAx
15
+ YjA0MTBmNjU3NWEzN2FmNTQyY2QwOWZmOWRkMGI2OTU4NjNhNDE=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grape_cache (0.2.1)
4
+ grape_cache (0.2.4)
5
5
  grape (~> 0.16)
6
6
  multi_json
7
7
  oj
@@ -4,27 +4,25 @@ module GrapeCache
4
4
  class Middleware < Grape::Middleware::Base
5
5
  # Overwriting the method call! from Grape::Middleware::Base
6
6
  # Reason: Make the :before call to return the whole stack
7
- def call!(env)
8
- @env = env
7
+ def call!(env)
8
+ @env = env
9
9
  # Just here is moving!
10
10
  before_res = before
11
11
  return before_res unless before_res.nil?
12
12
  # end the overwrite
13
- begin
14
- @app_response = @app.call(@env)
15
- ensure
16
- begin
17
- after_response = after
18
- rescue StandardError => e
19
- warn "caught error of type #{e.class} in after callback inside #{self.class.name} : #{e.message}"
20
- raise e
21
- end
22
- end
23
-
24
- response = after_response || @app_response
25
- merge_headers response
26
- response
27
- end
13
+ @app_response = @app.call(@env)
14
+
15
+ begin
16
+ after_response = after
17
+ rescue StandardError => e
18
+ warn "caught error of type #{e.class} in after callback inside #{self.class.name} : #{e.message}"
19
+ raise e
20
+ end
21
+
22
+ response = after_response || @app_response
23
+ merge_headers response
24
+ response
25
+ end
28
26
 
29
27
  #
30
28
  def after
@@ -82,7 +80,7 @@ module GrapeCache
82
80
  res = "grape_cache/#{digest(route)}/#{digest(opts)}"
83
81
 
84
82
  # Add the namespace (if its necessary)
85
- "#{ns}/#{res}" if ns.nil?
83
+ return "#{ns}/#{res}" unless ns.nil?
86
84
 
87
85
  # Return the result
88
86
  res
@@ -2,6 +2,6 @@
2
2
  module GrapeCache
3
3
  # Gem version
4
4
  def self.version
5
- '0.2.1'.freeze
5
+ '0.2.4'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Corado
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-06 00:00:00.000000000 Z
11
+ date: 2016-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json