rack-logjam 0.2.0 → 0.2.1

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: 100c480a6bdd47bb50ebbacbde5f69019c7c386c
4
- data.tar.gz: 4e737fc841d55db1bdd4c06b2968890e746ca230
3
+ metadata.gz: aace5c267c51e85b20980d0ce16e5c72bc2ce87f
4
+ data.tar.gz: 6f1000c624aa8c11fab417da7359bb6eb64f1d28
5
5
  SHA512:
6
- metadata.gz: 7d2b976933f0ad9827c1fb5521813b79b0d8b852db8becfb9a03d87d839e8c0cc74406ab1d8263832ec78909d5b5a5ac5109522b4385b594666d071ea182b15e
7
- data.tar.gz: d5422d0782d60ea1181119862976e92488244bfdeac02ad3129821e137cf2dd52ff5f1ee5b391c2b966840f15f5bb9d5739ef78112db30589f5be5224c2606ae
6
+ metadata.gz: 126d159ecc426f1f56447e6a8b8f836609a692ed30a0e0f24ec0e6d54262a5d9a1e7c3d7b9486e08429287bbb83bdd7484c7843cba8a29732b0b8b4e92cd72d3
7
+ data.tar.gz: e83a7e9dd7281ccce5729c7eeb7f41234d0add5bc051bb09bba4d92b1e7ed5dd1719efa165e2d3fccb0a2f18eefdeefe08eb45882aecf2526578470c6999f57a
@@ -6,12 +6,17 @@ module Rack
6
6
  class Json < Rack::Logjam::Filters::Base
7
7
 
8
8
  def render
9
+ return content if blank_content?
9
10
  apply_filters
10
11
  json_path.to_json
11
12
  end
12
13
 
13
14
  protected
14
15
 
16
+ def blank_content?
17
+ content.nil? || content.strip.empty?
18
+ end
19
+
15
20
  def apply_filters
16
21
  filters.each do |j_path, action, length|
17
22
  json_path.gsub!( j_path ) do |val|
@@ -74,8 +74,8 @@ Body:
74
74
  end
75
75
 
76
76
  def fetch_formatter( format, body )
77
- return Rack::Logjam::Array if body.is_a?( Array )
78
- return Rack::Logjam::Empty if body.strip.nil? || body.strip.empty?
77
+ return Rack::Logjam::Formatters::Empty if body.nil? || body.strip.empty?
78
+ return Rack::Logjam::Formatters::Array if body.is_a?( Array )
79
79
  Rack::Logjam::Formatters.get( format )
80
80
  end
81
81
 
@@ -2,7 +2,7 @@ module Rack
2
2
 
3
3
  module Logjam
4
4
 
5
- VERSION = '0.2.0'
5
+ VERSION = '0.2.1'
6
6
 
7
7
  end
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-logjam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Harrelson