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/lib/oj/json.rb CHANGED
@@ -1,176 +1,188 @@
1
-
2
1
  require 'ostruct'
3
2
  require 'oj/state'
4
3
 
5
- module JSON
6
- NaN = 0.0/0.0 unless defined?(::JSON::NaN)
7
- Infinity = 1.0/0.0 unless defined?(::JSON::Infinity)
8
- MinusInfinity = -1.0/0.0 unless defined?(::JSON::MinusInfinity)
9
- # Taken from the unit test. Note that items like check_circular? are not
10
- # present.
11
- PRETTY_STATE_PROTOTYPE = Ext::Generator::State.from_state({
12
- :allow_nan => false,
13
- :array_nl => "\n",
14
- :ascii_only => false,
15
- :buffer_initial_length => 1024,
16
- :depth => 0,
17
- :indent => " ",
18
- :max_nesting => 100,
19
- :object_nl => "\n",
20
- :space => " ",
21
- :space_before => "",
22
- }) unless defined?(::JSON::PRETTY_STATE_PROTOTYPE)
23
- SAFE_STATE_PROTOTYPE = Ext::Generator::State.from_state({
24
- :allow_nan => false,
25
- :array_nl => "",
26
- :ascii_only => false,
27
- :buffer_initial_length => 1024,
28
- :depth => 0,
29
- :indent => "",
30
- :max_nesting => 100,
31
- :object_nl => "",
32
- :space => "",
33
- :space_before => "",
34
- }) unless defined?(::JSON::SAFE_STATE_PROTOTYPE)
35
- FAST_STATE_PROTOTYPE = Ext::Generator::State.from_state({
36
- :allow_nan => false,
37
- :array_nl => "",
38
- :ascii_only => false,
39
- :buffer_initial_length => 1024,
40
- :depth => 0,
41
- :indent => "",
42
- :max_nesting => 0,
43
- :object_nl => "",
44
- :space => "",
45
- :space_before => "",
46
- }) unless defined?(::JSON::FAST_STATE_PROTOTYPE)
47
-
48
- def self.dump_default_options
49
- Oj::MimicDumpOption.new
50
- end
51
-
52
- def self.dump_default_options=(h)
53
- m = Oj::MimicDumpOption.new
54
- h.each do |k,v|
55
- m[k] = v
4
+ if defined?(JSON::PRETTY_STATE_PROTOTYPE)
5
+ # There are enough people that try to use both the json gen and oj in mimic
6
+ # mode so don't display the warning.
7
+
8
+ # warn "WARNING: oj/json is a compatability shim used by Oj. Requiring the file explicitly is not recommended."
9
+ end
10
+
11
+ unless defined?(JSON::PRETTY_STATE_PROTOTYPE)
12
+ module JSON
13
+ NaN = 0.0/0.0 unless defined?(::JSON::NaN)
14
+ Infinity = 1.0/0.0 unless defined?(::JSON::Infinity)
15
+ MinusInfinity = -1.0/0.0 unless defined?(::JSON::MinusInfinity)
16
+ # Taken from the unit test. Note that items like check_circular? are not
17
+ # present.
18
+ PRETTY_STATE_PROTOTYPE = Ext::Generator::State.from_state({
19
+ :allow_nan => false,
20
+ :array_nl => "\n",
21
+ :ascii_only => false,
22
+ :buffer_initial_length => 1024,
23
+ :depth => 0,
24
+ :indent => " ",
25
+ :max_nesting => 100,
26
+ :object_nl => "\n",
27
+ :space => " ",
28
+ :space_before => "",
29
+ }) unless defined?(::JSON::PRETTY_STATE_PROTOTYPE)
30
+ SAFE_STATE_PROTOTYPE = Ext::Generator::State.from_state({
31
+ :allow_nan => false,
32
+ :array_nl => "",
33
+ :ascii_only => false,
34
+ :buffer_initial_length => 1024,
35
+ :depth => 0,
36
+ :indent => "",
37
+ :max_nesting => 100,
38
+ :object_nl => "",
39
+ :space => "",
40
+ :space_before => "",
41
+ }) unless defined?(::JSON::SAFE_STATE_PROTOTYPE)
42
+ FAST_STATE_PROTOTYPE = Ext::Generator::State.from_state({
43
+ :allow_nan => false,
44
+ :array_nl => "",
45
+ :ascii_only => false,
46
+ :buffer_initial_length => 1024,
47
+ :depth => 0,
48
+ :indent => "",
49
+ :max_nesting => 0,
50
+ :object_nl => "",
51
+ :space => "",
52
+ :space_before => "",
53
+ }) unless defined?(::JSON::FAST_STATE_PROTOTYPE)
54
+
55
+ def self.dump_default_options
56
+ Oj::MimicDumpOption.new
56
57
  end
57
- end
58
58
 
59
- def self.parser=(p)
60
- @@parser = p
61
- end
59
+ def self.dump_default_options=(h)
60
+ m = Oj::MimicDumpOption.new
61
+ h.each do |k, v|
62
+ m[k] = v
63
+ end
64
+ end
62
65
 
63
- def self.parser()
64
- @@parser
65
- end
66
+ def self.parser=(p)
67
+ @@parser = p
68
+ end
66
69
 
67
- def self.generator=(g)
68
- @@generator = g
69
- end
70
+ def self.parser()
71
+ @@parser
72
+ end
70
73
 
71
- def self.generator()
72
- @@generator
73
- end
74
+ def self.generator=(g)
75
+ @@generator = g
76
+ end
74
77
 
75
- module Ext
76
- class Parser
77
- def initialize(src)
78
- raise TypeError.new("already initialized") unless @source.nil?
79
- @source = src
80
- end
78
+ def self.generator()
79
+ @@generator
80
+ end
81
81
 
82
- def source()
83
- raise TypeError.new("already initialized") if @source.nil?
84
- @source
85
- end
86
-
87
- def parse()
88
- raise TypeError.new("already initialized") if @source.nil?
89
- JSON.parse(@source)
90
- end
91
-
92
- end # Parser
93
- end # Ext
94
-
95
- State = ::JSON::Ext::Generator::State unless defined?(::JSON::State)
96
-
97
- begin
98
- send(:remove_const, :Parser)
99
- rescue
100
- end
101
- Parser = ::JSON::Ext::Parser unless defined?(::JSON::Parser)
102
- self.parser = ::JSON::Ext::Parser
103
- self.generator = ::JSON::Ext::Generator
104
-
105
- # Taken directly from the json gem. Shamelessly copied. It is similar in
106
- # some ways to the Oj::Bag class or the Oj::EasyHash class.
107
- class GenericObject < OpenStruct
108
- class << self
109
- alias [] new
110
-
111
- def json_creatable?
112
- @json_creatable
113
- end
82
+ module Ext
83
+ class Parser
84
+ def initialize(src)
85
+ raise TypeError.new("already initialized") unless @source.nil?
114
86
 
115
- attr_writer :json_creatable
87
+ @source = src
88
+ end
116
89
 
117
- def json_create(data)
118
- data = data.dup
119
- data.delete JSON.create_id
120
- self[data]
121
- end
90
+ def source()
91
+ raise TypeError.new("already initialized") if @source.nil?
122
92
 
123
- def from_hash(object)
124
- case
125
- when object.respond_to?(:to_hash)
126
- result = new
127
- object.to_hash.each do |key, value|
128
- result[key] = from_hash(value)
129
- end
130
- result
131
- when object.respond_to?(:to_ary)
132
- object.to_ary.map { |a| from_hash(a) }
133
- else
134
- object
93
+ @source
135
94
  end
136
- end
137
95
 
138
- def load(source, proc = nil, opts = {})
139
- result = ::JSON.load(source, proc, opts.merge(:object_class => self))
140
- result.nil? ? new : result
141
- end
96
+ def parse()
97
+ raise TypeError.new("already initialized") if @source.nil?
142
98
 
143
- def dump(obj, *args)
144
- ::JSON.dump(obj, *args)
145
- end
99
+ JSON.parse(@source)
100
+ end
146
101
 
147
- end # self
102
+ end # Parser
103
+ end # Ext
148
104
 
149
- self.json_creatable = false
105
+ State = ::JSON::Ext::Generator::State unless defined?(::JSON::State)
150
106
 
151
- def to_hash
152
- table
107
+ begin
108
+ send(:remove_const, :Parser)
109
+ rescue
110
+ # ignore and move on
153
111
  end
112
+ Parser = ::JSON::Ext::Parser unless defined?(::JSON::Parser)
113
+ self.parser = ::JSON::Ext::Parser
114
+ self.generator = ::JSON::Ext::Generator
115
+
116
+ # Taken directly from the json gem. Shamelessly copied. It is similar in
117
+ # some ways to the Oj::Bag class or the Oj::EasyHash class.
118
+ class GenericObject < OpenStruct
119
+ class << self
120
+ alias [] new
121
+
122
+ def json_creatable?
123
+ @json_creatable
124
+ end
154
125
 
155
- def [](name)
156
- __send__(name)
157
- end unless method_defined?(:[])
126
+ attr_writer :json_creatable
158
127
 
159
- def []=(name, value)
160
- __send__("#{name}=", value)
161
- end unless method_defined?(:[]=)
128
+ def json_create(data)
129
+ data = data.dup
130
+ data.delete JSON.create_id
131
+ self[data]
132
+ end
162
133
 
163
- def |(other)
164
- self.class[other.to_hash.merge(to_hash)]
165
- end
134
+ def from_hash(object)
135
+ case
136
+ when object.respond_to?(:to_hash)
137
+ result = new
138
+ object.to_hash.each do |key, value|
139
+ result[key] = from_hash(value)
140
+ end
141
+ result
142
+ when object.respond_to?(:to_ary)
143
+ object.to_ary.map { |a| from_hash(a) }
144
+ else
145
+ object
146
+ end
147
+ end
166
148
 
167
- def as_json(*)
168
- { JSON.create_id => self.class.name }.merge to_hash
169
- end
149
+ def load(source, proc = nil, opts = {})
150
+ result = ::JSON.load(source, proc, opts.merge(:object_class => self))
151
+ result.nil? ? new : result
152
+ end
170
153
 
171
- def to_json(*a)
172
- as_json.to_json(*a)
154
+ def dump(obj, *args)
155
+ ::JSON.dump(obj, *args)
156
+ end
157
+
158
+ end # self
159
+
160
+ self.json_creatable = false
161
+
162
+ def to_hash
163
+ table
164
+ end
165
+
166
+ def [](name)
167
+ __send__(name)
168
+ end unless method_defined?(:[])
169
+
170
+ def []=(name, value)
171
+ __send__("#{name}=", value)
172
+ end unless method_defined?(:[]=)
173
+
174
+ def |(other)
175
+ self.class[other.to_hash.merge(to_hash)]
176
+ end
177
+
178
+ def as_json(*)
179
+ { JSON.create_id => self.class.name }.merge to_hash
180
+ end
181
+
182
+ def to_json(*a)
183
+ as_json.to_json(*a)
184
+ end
173
185
  end
174
- end
175
-
176
- end # JSON
186
+
187
+ end # JSON
188
+ end
data/lib/oj/mimic.rb CHANGED
@@ -1,10 +1,7 @@
1
+ # frozen_string_literal: false
1
2
 
2
3
  require 'bigdecimal'
3
- begin
4
- require 'ostruct'
5
- rescue Exception
6
- # ignore
7
- end
4
+ require 'ostruct'
8
5
 
9
6
  module Oj
10
7
 
@@ -64,6 +61,8 @@ module Oj
64
61
  self.store(:allow_nan, true)
65
62
  self.store(:quirks_mode, oo[:quirks_mode])
66
63
  self.store(:ascii_only, (:ascii == oo[:escape_mode]))
64
+
65
+ super
67
66
  end
68
67
 
69
68
  def []=(key, value)
@@ -102,6 +101,7 @@ module Oj
102
101
  def as_json(*)
103
102
  name = self.class.name.to_s
104
103
  raise JSON::JSONError, "Only named structs are supported!" if 0 == name.length
104
+
105
105
  { JSON.create_id => name, 't' => table }
106
106
  end
107
107
  end
@@ -232,6 +232,7 @@ module Oj
232
232
  def as_json(*)
233
233
  name = self.class.name.to_s
234
234
  raise JSON::JSONError, "Only named structs are supported!" if 0 == name.length
235
+
235
236
  { JSON.create_id => name, 'v' => values }
236
237
  end
237
238
  end
@@ -263,7 +264,7 @@ module Oj
263
264
  end
264
265
  end
265
266
  def self.json_create(h)
266
- if usec = h.delete('u')
267
+ if (usec = h.delete('u'))
267
268
  h['n'] = usec * 1000
268
269
  end
269
270
  if instance_methods.include?(:tv_nsec)
@@ -273,7 +274,6 @@ module Oj
273
274
  end
274
275
  end
275
276
  end
276
-
277
277
  end # self.mimic_loaded
278
278
 
279
279
  end # Oj
data/lib/oj/schandler.rb CHANGED
@@ -64,13 +64,14 @@ module Oj
64
64
  #
65
65
  # hash_end
66
66
  #
67
- # When a hash key is encountered the hash_key method is called with the parsed
68
- # hash value key. The return value from the call is then used as the key in
69
- # the key-value pair that follows.
67
+ # At the end of a JSON object element the hash_end() callback is called if
68
+ # public.
70
69
  #
71
70
  # hash_key
72
71
  #
73
- # At the end of a JSON object element the hash_end() callback is called if public.
72
+ # When a hash key is encountered the hash_key() method is called with the
73
+ # parsed hash value key. The return value from the call is then used as the
74
+ # key in the key-value pair that follows.
74
75
  #
75
76
  # hash_set
76
77
  #
data/lib/oj/state.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  module JSON
3
2
  module Ext
4
3
  module Generator
@@ -59,6 +58,7 @@ module JSON
59
58
 
60
59
  def configure(opts)
61
60
  raise TypeError.new('expected a Hash') unless opts.respond_to?(:to_h)
61
+
62
62
  @attrs.merge!(opts.to_h)
63
63
  end
64
64
 
@@ -84,6 +84,7 @@ module JSON
84
84
  return true if super
85
85
  return true if has_key?(key)
86
86
  return true if has_key?(key.to_s)
87
+
87
88
  has_key?(key.to_sym)
88
89
  end
89
90
 
@@ -113,15 +114,17 @@ module JSON
113
114
  def method_missing(m, *args, &block)
114
115
  if m.to_s.end_with?('=')
115
116
  raise ArgumentError.new("wrong number of arguments (#{args.size} for 1 with #{m}) to method #{m}") if args.nil? or 1 != args.length
117
+
116
118
  m = m.to_s[0..-2]
117
119
  m = m.to_sym
118
120
  return @attrs.store(m, args[0])
119
- end
120
- if @attrs.has_key?(m.to_sym)
121
+ end
122
+ if @attrs.has_key?(m.to_sym)
121
123
  raise ArgumentError.new("wrong number of arguments (#{args.size} for 0 with #{m}) to method #{m}") unless args.nil? or args.empty?
124
+
122
125
  return @attrs[m.to_sym]
123
- end
124
- return @attrs.send(m, *args, &block)
126
+ end
127
+ return @attrs.send(m, *args, &block)
125
128
  end
126
129
 
127
130
  end # State
data/lib/oj/version.rb CHANGED
@@ -1,5 +1,4 @@
1
-
2
1
  module Oj
3
2
  # Current version of the module.
4
- VERSION = '3.13.23'
3
+ VERSION = '3.16.10'
5
4
  end
data/lib/oj.rb CHANGED
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
1
2
 
3
+ # Oj module is defined in oj.c.
2
4
  module Oj
3
5
  end
4
6
 
@@ -0,0 +1,20 @@
1
+ # Oj Install Options
2
+
3
+ ### Enable trace log
4
+
5
+ ```
6
+ $ gem install oj -- --enable-trace-log
7
+ ```
8
+
9
+ To enable Oj trace feature, it uses `--enable-trace-log` option when installing the gem.
10
+ Then, the trace logs will be displayed when `:trace` option is set to `true`.
11
+
12
+
13
+ ### Enable SIMD instructions
14
+
15
+ ```
16
+ $ gem install oj -- --with-sse42
17
+ ```
18
+
19
+ To enable the use of SIMD instructions in Oj, it uses the `--with-sse42` option when installing the gem.
20
+ This will enable the use of the SSE4.2 instructions in the internal.
data/pages/Options.md CHANGED
@@ -265,6 +265,10 @@ to true.
265
265
 
266
266
  The number of digits after the decimal when dumping the seconds of time.
267
267
 
268
+ ### :skip_null_byte [Boolean]
269
+
270
+ If true, null bytes in strings will be omitted when dumping.
271
+
268
272
  ### :space
269
273
 
270
274
  String inserted after the ':' character when dumping a JSON object. The