oj 3.13.23 → 3.16.10

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.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +86 -0
  3. data/README.md +2 -2
  4. data/ext/oj/buf.h +7 -6
  5. data/ext/oj/cache.c +29 -26
  6. data/ext/oj/cache.h +3 -2
  7. data/ext/oj/cache8.c +10 -9
  8. data/ext/oj/circarray.c +7 -5
  9. data/ext/oj/circarray.h +2 -2
  10. data/ext/oj/code.c +5 -12
  11. data/ext/oj/code.h +2 -2
  12. data/ext/oj/compat.c +20 -60
  13. data/ext/oj/custom.c +26 -59
  14. data/ext/oj/debug.c +3 -9
  15. data/ext/oj/dump.c +103 -53
  16. data/ext/oj/dump.h +1 -4
  17. data/ext/oj/dump_compat.c +557 -592
  18. data/ext/oj/dump_leaf.c +3 -5
  19. data/ext/oj/dump_object.c +42 -48
  20. data/ext/oj/dump_strict.c +10 -22
  21. data/ext/oj/encoder.c +1 -1
  22. data/ext/oj/err.c +2 -13
  23. data/ext/oj/err.h +9 -12
  24. data/ext/oj/extconf.rb +16 -7
  25. data/ext/oj/fast.c +63 -98
  26. data/ext/oj/intern.c +62 -47
  27. data/ext/oj/intern.h +3 -7
  28. data/ext/oj/mem.c +318 -0
  29. data/ext/oj/mem.h +53 -0
  30. data/ext/oj/mimic_json.c +54 -38
  31. data/ext/oj/object.c +33 -43
  32. data/ext/oj/odd.c +8 -6
  33. data/ext/oj/odd.h +4 -4
  34. data/ext/oj/oj.c +245 -216
  35. data/ext/oj/oj.h +83 -81
  36. data/ext/oj/parse.c +109 -153
  37. data/ext/oj/parse.h +21 -24
  38. data/ext/oj/parser.c +80 -67
  39. data/ext/oj/parser.h +9 -8
  40. data/ext/oj/rails.c +71 -94
  41. data/ext/oj/reader.c +9 -14
  42. data/ext/oj/reader.h +4 -2
  43. data/ext/oj/resolve.c +3 -4
  44. data/ext/oj/rxclass.c +6 -5
  45. data/ext/oj/rxclass.h +1 -1
  46. data/ext/oj/saj.c +13 -15
  47. data/ext/oj/saj2.c +37 -49
  48. data/ext/oj/saj2.h +1 -1
  49. data/ext/oj/scp.c +6 -20
  50. data/ext/oj/sparse.c +22 -70
  51. data/ext/oj/stream_writer.c +46 -48
  52. data/ext/oj/strict.c +22 -56
  53. data/ext/oj/string_writer.c +64 -40
  54. data/ext/oj/trace.h +31 -4
  55. data/ext/oj/usual.c +125 -114
  56. data/ext/oj/usual.h +7 -6
  57. data/ext/oj/util.h +1 -1
  58. data/ext/oj/val_stack.c +13 -2
  59. data/ext/oj/val_stack.h +8 -7
  60. data/ext/oj/wab.c +25 -57
  61. data/lib/oj/active_support_helper.rb +1 -3
  62. data/lib/oj/bag.rb +7 -1
  63. data/lib/oj/easy_hash.rb +4 -5
  64. data/lib/oj/error.rb +0 -1
  65. data/lib/oj/json.rb +162 -150
  66. data/lib/oj/mimic.rb +7 -7
  67. data/lib/oj/schandler.rb +5 -4
  68. data/lib/oj/state.rb +8 -5
  69. data/lib/oj/version.rb +1 -2
  70. data/lib/oj.rb +2 -0
  71. data/pages/InstallOptions.md +20 -0
  72. data/pages/Options.md +4 -0
  73. metadata +46 -121
  74. data/test/_test_active.rb +0 -76
  75. data/test/_test_active_mimic.rb +0 -96
  76. data/test/_test_mimic_rails.rb +0 -126
  77. data/test/activerecord/result_test.rb +0 -32
  78. data/test/activesupport4/decoding_test.rb +0 -108
  79. data/test/activesupport4/encoding_test.rb +0 -531
  80. data/test/activesupport4/test_helper.rb +0 -41
  81. data/test/activesupport5/abstract_unit.rb +0 -45
  82. data/test/activesupport5/decoding_test.rb +0 -133
  83. data/test/activesupport5/encoding_test.rb +0 -500
  84. data/test/activesupport5/encoding_test_cases.rb +0 -98
  85. data/test/activesupport5/test_helper.rb +0 -72
  86. data/test/activesupport5/time_zone_test_helpers.rb +0 -39
  87. data/test/activesupport6/abstract_unit.rb +0 -44
  88. data/test/activesupport6/decoding_test.rb +0 -133
  89. data/test/activesupport6/encoding_test.rb +0 -507
  90. data/test/activesupport6/encoding_test_cases.rb +0 -98
  91. data/test/activesupport6/test_common.rb +0 -17
  92. data/test/activesupport6/test_helper.rb +0 -163
  93. data/test/activesupport6/time_zone_test_helpers.rb +0 -39
  94. data/test/activesupport7/abstract_unit.rb +0 -49
  95. data/test/activesupport7/decoding_test.rb +0 -125
  96. data/test/activesupport7/encoding_test.rb +0 -486
  97. data/test/activesupport7/encoding_test_cases.rb +0 -104
  98. data/test/activesupport7/time_zone_test_helpers.rb +0 -47
  99. data/test/bar.rb +0 -11
  100. data/test/baz.rb +0 -16
  101. data/test/bug.rb +0 -16
  102. data/test/files.rb +0 -29
  103. data/test/foo.rb +0 -77
  104. data/test/helper.rb +0 -42
  105. data/test/isolated/shared.rb +0 -308
  106. data/test/isolated/test_mimic_after.rb +0 -13
  107. data/test/isolated/test_mimic_alone.rb +0 -12
  108. data/test/isolated/test_mimic_as_json.rb +0 -45
  109. data/test/isolated/test_mimic_before.rb +0 -13
  110. data/test/isolated/test_mimic_define.rb +0 -28
  111. data/test/isolated/test_mimic_rails_after.rb +0 -22
  112. data/test/isolated/test_mimic_rails_before.rb +0 -21
  113. data/test/isolated/test_mimic_redefine.rb +0 -15
  114. data/test/json_gem/json_addition_test.rb +0 -216
  115. data/test/json_gem/json_common_interface_test.rb +0 -153
  116. data/test/json_gem/json_encoding_test.rb +0 -107
  117. data/test/json_gem/json_ext_parser_test.rb +0 -20
  118. data/test/json_gem/json_fixtures_test.rb +0 -35
  119. data/test/json_gem/json_generator_test.rb +0 -396
  120. data/test/json_gem/json_generic_object_test.rb +0 -90
  121. data/test/json_gem/json_parser_test.rb +0 -477
  122. data/test/json_gem/json_string_matching_test.rb +0 -42
  123. data/test/json_gem/test_helper.rb +0 -30
  124. data/test/mem.rb +0 -33
  125. data/test/perf.rb +0 -107
  126. data/test/perf_compat.rb +0 -130
  127. data/test/perf_dump.rb +0 -50
  128. data/test/perf_fast.rb +0 -164
  129. data/test/perf_file.rb +0 -64
  130. data/test/perf_object.rb +0 -138
  131. data/test/perf_once.rb +0 -58
  132. data/test/perf_parser.rb +0 -189
  133. data/test/perf_saj.rb +0 -109
  134. data/test/perf_scp.rb +0 -152
  135. data/test/perf_simple.rb +0 -287
  136. data/test/perf_strict.rb +0 -139
  137. data/test/perf_wab.rb +0 -131
  138. data/test/prec.rb +0 -23
  139. data/test/sample/change.rb +0 -14
  140. data/test/sample/dir.rb +0 -19
  141. data/test/sample/doc.rb +0 -36
  142. data/test/sample/file.rb +0 -48
  143. data/test/sample/group.rb +0 -16
  144. data/test/sample/hasprops.rb +0 -16
  145. data/test/sample/layer.rb +0 -12
  146. data/test/sample/line.rb +0 -20
  147. data/test/sample/oval.rb +0 -10
  148. data/test/sample/rect.rb +0 -10
  149. data/test/sample/shape.rb +0 -35
  150. data/test/sample/text.rb +0 -20
  151. data/test/sample.rb +0 -54
  152. data/test/sample_json.rb +0 -37
  153. data/test/test_compat.rb +0 -540
  154. data/test/test_custom.rb +0 -544
  155. data/test/test_debian.rb +0 -53
  156. data/test/test_fast.rb +0 -530
  157. data/test/test_file.rb +0 -255
  158. data/test/test_gc.rb +0 -60
  159. data/test/test_generate.rb +0 -21
  160. data/test/test_hash.rb +0 -39
  161. data/test/test_integer_range.rb +0 -72
  162. data/test/test_null.rb +0 -376
  163. data/test/test_object.rb +0 -1025
  164. data/test/test_parser.rb +0 -11
  165. data/test/test_parser_debug.rb +0 -27
  166. data/test/test_parser_saj.rb +0 -335
  167. data/test/test_parser_usual.rb +0 -217
  168. data/test/test_rails.rb +0 -35
  169. data/test/test_saj.rb +0 -186
  170. data/test/test_scp.rb +0 -431
  171. data/test/test_strict.rb +0 -435
  172. data/test/test_various.rb +0 -752
  173. data/test/test_wab.rb +0 -309
  174. data/test/test_writer.rb +0 -380
  175. data/test/tests.rb +0 -33
  176. data/test/tests_mimic.rb +0 -23
  177. data/test/tests_mimic_addition.rb +0 -16
  178. data/test/zoo.rb +0 -13
data/test/sample/group.rb DELETED
@@ -1,16 +0,0 @@
1
-
2
- module Sample
3
- class Group
4
- attr_reader :members
5
-
6
- def initialize()
7
- @members = []
8
- end
9
-
10
- def <<(member)
11
- @members << member
12
- end
13
-
14
- end # Group
15
- end # Sample
16
-
@@ -1,16 +0,0 @@
1
-
2
- module Sample
3
- module HasProps
4
-
5
- def add_prop(key, value)
6
- @props = { } unless self.instance_variable_defined?(:@props)
7
- @props[key] = value
8
- end
9
-
10
- def props
11
- @props = { } unless self.instance_variable_defined?(:@props)
12
- @props
13
- end
14
-
15
- end # HasProps
16
- end # Sample
data/test/sample/layer.rb DELETED
@@ -1,12 +0,0 @@
1
-
2
- module Sample
3
- class Layer < Group
4
- attr_accessor :name
5
-
6
- def initialize(name)
7
- super()
8
- @name = name
9
- end
10
-
11
- end # Layer
12
- end # Sample
data/test/sample/line.rb DELETED
@@ -1,20 +0,0 @@
1
- module Sample
2
-
3
- class Line
4
- include HasProps
5
-
6
- attr_accessor :x, :y, :dx, :dy
7
- attr_accessor :color
8
- attr_accessor :thick
9
-
10
- def initialize(x, y, dx, dy, thick, color)
11
- @x = x
12
- @y = y
13
- @dx = dx
14
- @dy = dy
15
- @thick = thick
16
- @color = color
17
- end
18
-
19
- end # Line
20
- end # Sample
data/test/sample/oval.rb DELETED
@@ -1,10 +0,0 @@
1
- module Sample
2
-
3
- class Oval < Shape
4
-
5
- def initialize(left, top, wide, high, color=nil)
6
- super
7
- end
8
-
9
- end # Oval
10
- end # Sample
data/test/sample/rect.rb DELETED
@@ -1,10 +0,0 @@
1
-
2
- module Sample
3
- class Rect < Shape
4
-
5
- def initialize(left, top, wide, high, color=nil)
6
- super
7
- end
8
-
9
- end # Rect
10
- end # Sample
data/test/sample/shape.rb DELETED
@@ -1,35 +0,0 @@
1
-
2
- module Sample
3
- class Shape
4
- include HasProps
5
-
6
- attr_accessor :bounds
7
- attr_accessor :color
8
- attr_accessor :border, :border_color
9
-
10
- def initialize(left, top, wide, high, color=nil)
11
- @bounds = [[left, top], [left + wide, top + high]]
12
- @color = color
13
- @border = 1
14
- @border_color = :black
15
- end
16
-
17
- def left
18
- @bounds[0][0]
19
- end
20
-
21
- def top
22
- @bounds[0][1]
23
- end
24
-
25
- def width
26
- @bounds[1][0] - @bounds[0][0]
27
- end
28
-
29
- def height
30
- @bounds[1][1] - @bounds[0][1]
31
- end
32
-
33
- end # Shape
34
- end # Sample
35
-
data/test/sample/text.rb DELETED
@@ -1,20 +0,0 @@
1
-
2
- module Sample
3
- class Text < Shape
4
- attr_accessor :text
5
- attr_accessor :font
6
- attr_accessor :font_size
7
- attr_accessor :just
8
- attr_accessor :text_color
9
-
10
- def initialize(text, left, top, wide, high, color=nil)
11
- super(left, top, wide, high, color)
12
- @text = text
13
- @font = 'helvetica'
14
- @font_size = 14
15
- @just = 'left'
16
- @text_color = 'black'
17
- end
18
-
19
- end # Text
20
- end # Sample
data/test/sample.rb DELETED
@@ -1,54 +0,0 @@
1
- #!/usr/bin/env ruby -wW2
2
-
3
- if $0 == __FILE__
4
- $: << '.'
5
- $: << '..'
6
- $: << '../lib'
7
- $: << '../ext'
8
- end
9
-
10
- require 'pp'
11
- require 'sample/doc'
12
-
13
- def sample_doc(size=3)
14
- colors = [ :black, :gray, :white, :red, :blue, :yellow, :green, :purple, :orange ]
15
-
16
- d = ::Sample::Doc.new('Sample')
17
-
18
- # add some history
19
- (0..size * 10).each do |i|
20
- d.add_change("Changed at t+#{i}.")
21
- end
22
-
23
- # add some layers
24
- (1..size).each do |i|
25
- layer = ::Sample::Layer.new("Layer-#{i}")
26
- (1..size).each do |j|
27
- g = ::Sample::Group.new
28
- (1..size).each do |k|
29
- g2 = ::Sample::Group.new
30
- r = ::Sample::Rect.new(j * 40 + 10.0, i * 10.0,
31
- 10.123456 / k, 10.0 / k, colors[(i + j + k) % colors.size])
32
- r.add_prop(:part_of, layer.name)
33
- g2 << r
34
- g2 << ::Sample::Text.new("#{k} in #{j}", r.left, r.top, r.width, r.height)
35
- g << g2
36
- end
37
- g2 = ::Sample::Group.new
38
- (1..size).each do |k|
39
- o = ::Sample::Oval.new(j * 40 + 12.0, i * 10.0 + 2.0,
40
- 6.0 / k, 6.0 / k, colors[(i + j + k) % colors.size])
41
- o.add_prop(:inside, true)
42
- g << o
43
- end
44
- g << g2
45
- layer << g
46
- end
47
- d.layers[layer.name] = layer
48
- end
49
-
50
- # some properties
51
- d.add_prop(:purpose, 'an example')
52
-
53
- d
54
- end
data/test/sample_json.rb DELETED
@@ -1,37 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- if $0 == __FILE__
4
- $: << '.'
5
- $: << '..'
6
- $: << '../lib'
7
- $: << '../ext'
8
- end
9
-
10
- require 'pp'
11
- require 'oj'
12
-
13
- def sample_json(size=3)
14
- colors = [ :black, :gray, :white, :red, :blue, :yellow, :green, :purple, :orange ]
15
- container = []
16
- size.times do |i|
17
- box = {
18
- 'color' => colors[i % colors.size],
19
- 'fragile' => (0 == (i % 2)),
20
- 'width' => i,
21
- 'height' => i,
22
- 'depth' => i,
23
- 'weight' => i * 1.3,
24
- 'address' => {
25
- 'street' => "#{i} Main Street",
26
- 'city' => 'Sity',
27
- 'state' => nil
28
- }
29
- }
30
- container << box
31
- end
32
- container
33
- end
34
-
35
- if $0 == __FILE__
36
- File.open('sample.json', "w") { |f| f.write(Oj.dump(sample_json(3), :indent => 2)) }
37
- end