rack-profiler 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a343b0c57f979d808c382c43240fab52021e0d2b
4
- data.tar.gz: af40d1d74d3b9bcd3bb3e2497ce0173a20e6ea6c
3
+ metadata.gz: 1f5398210924d7b6d55e62cba6b5eaefbf0832f7
4
+ data.tar.gz: 2655da5d924948ee52e26d0dabe0714524828f1a
5
5
  SHA512:
6
- metadata.gz: 888e9762b98c4c8a6bb20d0db4eb23c53358b1b32a595e3c7383b585d8fd44854dd5bb03210a9489207e186e381584471b0520a5517a35b9988c1b4947a2ae38
7
- data.tar.gz: 9436e633d74ba37e8b347d6f8e5581a8bb7e2a059ca044759c495038367f20c490ce08b7426dcaa6fafe9318831a3dae1061cd34f129b77d9e3439ba2072f034
6
+ metadata.gz: d9416780b7a29246118e0e69eeff96c7bc4c0dc19d3ccdb382dfec0fed23b3079309ce8341436c1cafeae2701d3e485e666e7ed65fd69c3bf1554eeea8ce15b3
7
+ data.tar.gz: 663266c332ffc194a47af1043a1ef5e8087a25d3b2679bed29d0f8ba7a3e6fc09ba898a2b88b40f0a4cb2158da8fd30a9c364d791397bae84a03631a2bb270af
@@ -0,0 +1,10 @@
1
+ module Rack
2
+ module Grape
3
+ module EndpointJson
4
+ def as_json(options = nil)
5
+ return {}.as_json(options) if body.nil?
6
+ body.to_hash.as_json(options)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -3,7 +3,7 @@ require "rack/request"
3
3
  require "rack/auth/basic"
4
4
  require "rack/profiler/version"
5
5
  require "active_support/notifications"
6
- require "grape/endpoint"
6
+ require "rack/grape/endpoint_json"
7
7
 
8
8
  module Rack
9
9
  class Profiler
@@ -37,6 +37,10 @@ module Rack
37
37
  @app = app
38
38
  subscribe_to_default
39
39
  block.call(self) if block_given?
40
+
41
+ if defined?(::Grape::Endpoint)
42
+ ::Grape::Endpoint.include Rack::Grape::EndpointJson
43
+ end
40
44
  end
41
45
 
42
46
  def call(env)
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Profiler
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Ongaro
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-14 00:00:00.000000000 Z
12
+ date: 2016-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -95,7 +95,7 @@ files:
95
95
  - LICENSE.txt
96
96
  - README.md
97
97
  - Rakefile
98
- - lib/grape/endpoint.rb
98
+ - lib/rack/grape/endpoint_json.rb
99
99
  - lib/rack/profiler.rb
100
100
  - lib/rack/profiler/version.rb
101
101
  - public/rack-profiler.html
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.2.2
125
+ rubygems_version: 2.5.1
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: A simple profiler for Rack applications
@@ -1,7 +0,0 @@
1
- module Grape
2
- class Endpoint
3
- def as_json(options = nil)
4
- body.to_hash.as_json(options)
5
- end
6
- end
7
- end