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 +4 -4
- data/ext/oj/dump.c +1 -1
- data/ext/oj/parse.c +0 -6
- data/ext/oj/rails.c +0 -1
- data/lib/oj/version.rb +1 -1
- data/pages/Rails.md +4 -3
- data/test/bar.rb +21 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dab33e0024a7f3a4804bec003954f36fe21513bef170dfbc2e7efa9404af5958
|
4
|
+
data.tar.gz: ffc7b2b24406ea40d9cc312bfe466d3a4716e9e48dfc662e61519a10d12f2918
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52cf7dcce0aaf3d1dfd2e13265032f38c50587f73607f1c23e432e385d11f2e611bc670edd11002b9310892fb7f5589f775b83d65599dfb235b2ae8ad411462b
|
7
|
+
data.tar.gz: e6739fad6ff44371f051bc4b51aea8f748e0bd34cf84f75ac7bd2761b1e43dedae72bcc4c74621088242cf684ffee2aea6cb383ba74d0862b853e2bd141f57e8
|
data/ext/oj/dump.c
CHANGED
@@ -111,7 +111,7 @@ static char rails_friendly_chars[256] = "\
|
|
111
111
|
11111111111111111111111111111111\
|
112
112
|
11111111111111111111111111111111\
|
113
113
|
11111111111111111111111111111111\
|
114
|
-
|
114
|
+
11111111111111111111111111111111";
|
115
115
|
|
116
116
|
static void
|
117
117
|
raise_strict(VALUE obj) {
|
data/ext/oj/parse.c
CHANGED
@@ -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) {
|
data/ext/oj/rails.c
CHANGED
data/lib/oj/version.rb
CHANGED
data/pages/Rails.md
CHANGED
@@ -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
|
-
|
95
|
-
options[:
|
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
|
data/test/bar.rb
CHANGED
@@ -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
|
10
|
+
require "active_support/json"
|
13
11
|
|
14
|
-
|
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
|
-
|
27
|
+
require 'oj'
|
17
28
|
|
18
|
-
|
29
|
+
ActiveSupport::JSON::Encoding.escape_html_entities_in_json = false
|
30
|
+
puts "ActiveSupport.encode(s) - #{ActiveSupport::JSON.encode($s)}"
|
19
31
|
|
20
|
-
|
32
|
+
Oj.optimize_rails
|
33
|
+
Oj.default_options = { mode: :rails }
|
21
34
|
|
22
|
-
puts Oj.dump(
|
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.
|
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
|
11
|
+
date: 2020-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|