oj 3.10.2 → 3.10.3

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: '0569d0892b3b9d79f0edf0866d843adb9abc21046838be295164884edb930b61'
4
- data.tar.gz: ff04edae94da97c911b19c93015035df9fb3ce89162c0afc1df036e0f675e65f
3
+ metadata.gz: dab33e0024a7f3a4804bec003954f36fe21513bef170dfbc2e7efa9404af5958
4
+ data.tar.gz: ffc7b2b24406ea40d9cc312bfe466d3a4716e9e48dfc662e61519a10d12f2918
5
5
  SHA512:
6
- metadata.gz: 2d5a28e21b6c37bc5a11917512906c040cf8a0b038a07f23c0447a1705986fe98803191f6d2462e4f0ec67f7f3694cd9c61d0149d782f0a5e5f6b6d36a88d372
7
- data.tar.gz: 789c0fdfe061476ee5e5c4bbe84519e7b1a6a015436e7fbe2cdb5f7922d6eef8de5914bd61488be4c297633e053f2a217630f7358796de9ba746aa6935466983
6
+ metadata.gz: 52cf7dcce0aaf3d1dfd2e13265032f38c50587f73607f1c23e432e385d11f2e611bc670edd11002b9310892fb7f5589f775b83d65599dfb235b2ae8ad411462b
7
+ data.tar.gz: e6739fad6ff44371f051bc4b51aea8f748e0bd34cf84f75ac7bd2761b1e43dedae72bcc4c74621088242cf684ffee2aea6cb383ba74d0862b853e2bd141f57e8
@@ -111,7 +111,7 @@ static char rails_friendly_chars[256] = "\
111
111
  11111111111111111111111111111111\
112
112
  11111111111111111111111111111111\
113
113
  11111111111111111111111111111111\
114
- 11611111111111111111111111111111";
114
+ 11111111111111111111111111111111";
115
115
 
116
116
  static void
117
117
  raise_strict(VALUE obj) {
@@ -1041,12 +1041,6 @@ CLEANUP:
1041
1041
  if (pi->str_rx.head != oj_default_options.str_rx.head) {
1042
1042
  oj_rxclass_cleanup(&pi->str_rx);
1043
1043
  }
1044
- // TBD if validate only then (Qundef == result ??)
1045
- // if pi->err or 0 != line
1046
- // rb_get_errinfo();??
1047
- // rb_set_errinfo(Qnil);
1048
- // return nil or error
1049
-
1050
1044
  if (err_has(&pi->err)) {
1051
1045
  rb_set_errinfo(Qnil);
1052
1046
  if (Qnil != pi->err_class) {
@@ -1012,7 +1012,6 @@ rails_encode(int argc, VALUE *argv, VALUE self) {
1012
1012
  }
1013
1013
  }
1014
1014
 
1015
- // TBD provide a get function as well
1016
1015
  static VALUE
1017
1016
  rails_use_standard_json_time_format(VALUE self, VALUE state) {
1018
1017
  if (Qtrue == state || Qfalse == state) {
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '3.10.2'
4
+ VERSION = '3.10.3'
5
5
  end
@@ -89,10 +89,11 @@ require 'oj'
89
89
 
90
90
  module OjJsonEncoder
91
91
  def render(options = nil, extra_options = {}, &block)
92
- if options && options[:json]
92
+ if options && options.is_a?(Hash) && options[:json]
93
93
  obj = options.delete(:json)
94
- options[:text] = Oj.dump(obj, :mode => :rails)
95
- options[:content_type] = 'application/json'
94
+ obj = Oj.dump(obj, :mode => :rails) unless obj.is_a?(String)
95
+ options[:text] = obj
96
+ response.content_type ||= Mime::JSON
96
97
  end
97
98
  super
98
99
  end
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: UTF-8
3
2
 
4
3
  $: << File.dirname(__FILE__)
5
4
  $oj_dir = File.dirname(File.expand_path(File.dirname(__FILE__)))
@@ -7,16 +6,30 @@ $oj_dir = File.dirname(File.expand_path(File.dirname(__FILE__)))
7
6
  $: << File.join($oj_dir, dir)
8
7
  end
9
8
 
10
- require 'rails'
11
9
  require 'active_support'
12
- require 'active_support/json'
10
+ require "active_support/json"
13
11
 
14
- require 'oj'
12
+ $s = "\u2014 & \n \u{1F618}"
13
+
14
+ =begin
15
+ def check(label)
16
+ puts "\n--- #{label} --------------------"
17
+
18
+ ActiveSupport::JSON::Encoding.use_standard_json_time_format = true
19
+ puts "with standard_json == true: t.to_json - #{$t.to_json}"
20
+ ActiveSupport::JSON::Encoding.use_standard_json_time_format = false
21
+ puts "with standard_json == false: t.to_json - #{$t.to_json}"
22
+ end
23
+
24
+ check('Before Oj')
25
+ =end
15
26
 
16
- puts Rails::VERSION::STRING
27
+ require 'oj'
17
28
 
18
- #Oj.optimize_rails
29
+ ActiveSupport::JSON::Encoding.escape_html_entities_in_json = false
30
+ puts "ActiveSupport.encode(s) - #{ActiveSupport::JSON.encode($s)}"
19
31
 
20
- h = {foo: "bar"}
32
+ Oj.optimize_rails
33
+ Oj.default_options = { mode: :rails }
21
34
 
22
- puts Oj.dump(h, mode: :rails)
35
+ puts "Oj.dump(s) - #{Oj.dump($s)}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.2
4
+ version: 3.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-30 00:00:00.000000000 Z
11
+ date: 2020-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler