oj 3.13.0 → 3.13.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1266 -0
- data/README.md +1 -1
- data/ext/oj/cache.c +246 -107
- data/ext/oj/cache.h +2 -1
- data/ext/oj/compat.c +1 -2
- data/ext/oj/custom.c +5 -8
- data/ext/oj/debug.c +2 -1
- data/ext/oj/dump.c +1 -4
- data/ext/oj/dump_object.c +2 -2
- data/ext/oj/extconf.rb +1 -0
- data/ext/oj/fast.c +7 -18
- data/ext/oj/intern.c +106 -216
- data/ext/oj/intern.h +0 -1
- data/ext/oj/mimic_json.c +2 -2
- data/ext/oj/object.c +11 -40
- data/ext/oj/oj.c +11 -8
- data/ext/oj/parse.c +1 -1
- data/ext/oj/parser.c +99 -143
- data/ext/oj/rails.c +1 -1
- data/ext/oj/rxclass.c +1 -1
- data/ext/oj/saj.c +1 -1
- data/ext/oj/saj2.c +7 -5
- data/ext/oj/sparse.c +1 -1
- data/ext/oj/stream_writer.c +1 -1
- data/ext/oj/strict.c +1 -2
- data/ext/oj/string_writer.c +2 -2
- data/ext/oj/usual.c +55 -25
- data/ext/oj/validate.c +2 -1
- data/ext/oj/wab.c +6 -3
- data/lib/oj/error.rb +1 -1
- data/lib/oj/state.rb +8 -7
- data/lib/oj/version.rb +1 -1
- data/pages/Options.md +13 -3
- data/pages/Parser.md +3 -3
- data/pages/Rails.md +2 -2
- data/test/benny.rb +50 -0
- data/test/big.rb +15 -0
- data/test/foo.rb +3 -5
- data/test/json_gem/json_common_interface_test.rb +1 -1
- data/test/json_gem/json_generator_test.rb +1 -1
- data/test/mem.rb +33 -0
- data/test/perf_once.rb +58 -0
- data/test/perf_parser.rb +6 -1
- data/test/test_hash.rb +1 -1
- data/test/test_parser_memory.rb +45 -0
- metadata +16 -14
- data/ext/oj/hash_test.c +0 -464
- data/test/bar.rb +0 -35
- data/test/baz.rb +0 -16
- data/test/prec.rb +0 -23
- data/test/zoo.rb +0 -13
data/test/bar.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$: << File.dirname(__FILE__)
|
4
|
-
$oj_dir = File.dirname(File.expand_path(File.dirname(__FILE__)))
|
5
|
-
%w(lib ext).each do |dir|
|
6
|
-
$: << File.join($oj_dir, dir)
|
7
|
-
end
|
8
|
-
|
9
|
-
require 'active_support'
|
10
|
-
require "active_support/json"
|
11
|
-
|
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
|
26
|
-
|
27
|
-
require 'oj'
|
28
|
-
|
29
|
-
ActiveSupport::JSON::Encoding.escape_html_entities_in_json = false
|
30
|
-
puts "ActiveSupport.encode(s) - #{ActiveSupport::JSON.encode($s)}"
|
31
|
-
|
32
|
-
Oj.optimize_rails
|
33
|
-
Oj.default_options = { mode: :rails }
|
34
|
-
|
35
|
-
puts "Oj.dump(s) - #{Oj.dump($s)}"
|
data/test/baz.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$: << File.dirname(__FILE__)
|
4
|
-
$oj_dir = File.dirname(File.expand_path(File.dirname(__FILE__)))
|
5
|
-
%w(lib ext).each do |dir|
|
6
|
-
$: << File.join($oj_dir, dir)
|
7
|
-
end
|
8
|
-
|
9
|
-
require 'oj'
|
10
|
-
Oj.mimic_JSON()
|
11
|
-
|
12
|
-
begin
|
13
|
-
::JSON.load('name=&email=&subject=&comment=&submit=Send+Message')
|
14
|
-
rescue ::JSON::ParserError
|
15
|
-
puts "*** Pass"
|
16
|
-
end
|
data/test/prec.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'oj'
|
4
|
-
|
5
|
-
extras = {"locationLng" => -97.14690769100295}
|
6
|
-
|
7
|
-
Oj.default_options = {float_precision: 17}
|
8
|
-
|
9
|
-
encoded = Oj.dump(extras)
|
10
|
-
puts encoded
|
11
|
-
puts Oj.load(encoded)
|
12
|
-
|
13
|
-
require "active_record"
|
14
|
-
|
15
|
-
Oj::Rails.set_encoder()
|
16
|
-
Oj::Rails.set_decoder()
|
17
|
-
|
18
|
-
Oj.default_options = {float_precision: 17}
|
19
|
-
# Using Oj rails encoder, gets the correct value: {"locationLng":-97.14690769100295}
|
20
|
-
encoded = ActiveSupport::JSON.encode(extras)
|
21
|
-
puts encoded
|
22
|
-
puts ActiveSupport::JSON.decode(encoded)
|
23
|
-
puts Oj.load(encoded)
|