nano-safe-gem 0.0.1

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 (97) hide show
  1. checksums.yaml +7 -0
  2. data/nano-safe-gem.gemspec +12 -0
  3. data/oj-3.17.3/CHANGELOG.md +1506 -0
  4. data/oj-3.17.3/LICENSE +21 -0
  5. data/oj-3.17.3/README.md +103 -0
  6. data/oj-3.17.3/RELEASE_NOTES.md +61 -0
  7. data/oj-3.17.3/ext/oj/buf.h +85 -0
  8. data/oj-3.17.3/ext/oj/cache.c +329 -0
  9. data/oj-3.17.3/ext/oj/cache.h +22 -0
  10. data/oj-3.17.3/ext/oj/cache8.c +105 -0
  11. data/oj-3.17.3/ext/oj/cache8.h +21 -0
  12. data/oj-3.17.3/ext/oj/circarray.c +64 -0
  13. data/oj-3.17.3/ext/oj/circarray.h +22 -0
  14. data/oj-3.17.3/ext/oj/code.c +214 -0
  15. data/oj-3.17.3/ext/oj/code.h +40 -0
  16. data/oj-3.17.3/ext/oj/compat.c +239 -0
  17. data/oj-3.17.3/ext/oj/custom.c +1079 -0
  18. data/oj-3.17.3/ext/oj/debug.c +126 -0
  19. data/oj-3.17.3/ext/oj/dump.c +1765 -0
  20. data/oj-3.17.3/ext/oj/dump.h +112 -0
  21. data/oj-3.17.3/ext/oj/dump_compat.c +902 -0
  22. data/oj-3.17.3/ext/oj/dump_leaf.c +162 -0
  23. data/oj-3.17.3/ext/oj/dump_object.c +715 -0
  24. data/oj-3.17.3/ext/oj/dump_strict.c +404 -0
  25. data/oj-3.17.3/ext/oj/encode.h +16 -0
  26. data/oj-3.17.3/ext/oj/encoder.c +43 -0
  27. data/oj-3.17.3/ext/oj/err.c +57 -0
  28. data/oj-3.17.3/ext/oj/err.h +67 -0
  29. data/oj-3.17.3/ext/oj/extconf.rb +72 -0
  30. data/oj-3.17.3/ext/oj/fast.c +1730 -0
  31. data/oj-3.17.3/ext/oj/intern.c +313 -0
  32. data/oj-3.17.3/ext/oj/intern.h +22 -0
  33. data/oj-3.17.3/ext/oj/mem.c +318 -0
  34. data/oj-3.17.3/ext/oj/mem.h +53 -0
  35. data/oj-3.17.3/ext/oj/mimic_json.c +922 -0
  36. data/oj-3.17.3/ext/oj/object.c +726 -0
  37. data/oj-3.17.3/ext/oj/odd.c +245 -0
  38. data/oj-3.17.3/ext/oj/odd.h +43 -0
  39. data/oj-3.17.3/ext/oj/oj.c +2332 -0
  40. data/oj-3.17.3/ext/oj/oj.h +405 -0
  41. data/oj-3.17.3/ext/oj/parse.c +1367 -0
  42. data/oj-3.17.3/ext/oj/parse.h +113 -0
  43. data/oj-3.17.3/ext/oj/parser.c +1676 -0
  44. data/oj-3.17.3/ext/oj/parser.h +103 -0
  45. data/oj-3.17.3/ext/oj/rails.c +1480 -0
  46. data/oj-3.17.3/ext/oj/rails.h +18 -0
  47. data/oj-3.17.3/ext/oj/reader.c +220 -0
  48. data/oj-3.17.3/ext/oj/reader.h +137 -0
  49. data/oj-3.17.3/ext/oj/resolve.c +80 -0
  50. data/oj-3.17.3/ext/oj/resolve.h +12 -0
  51. data/oj-3.17.3/ext/oj/rxclass.c +144 -0
  52. data/oj-3.17.3/ext/oj/rxclass.h +26 -0
  53. data/oj-3.17.3/ext/oj/safe.c +230 -0
  54. data/oj-3.17.3/ext/oj/safe.h +79 -0
  55. data/oj-3.17.3/ext/oj/saj.c +677 -0
  56. data/oj-3.17.3/ext/oj/saj2.c +584 -0
  57. data/oj-3.17.3/ext/oj/saj2.h +23 -0
  58. data/oj-3.17.3/ext/oj/scp.c +185 -0
  59. data/oj-3.17.3/ext/oj/simd.h +219 -0
  60. data/oj-3.17.3/ext/oj/sparse.c +943 -0
  61. data/oj-3.17.3/ext/oj/stream_writer.c +329 -0
  62. data/oj-3.17.3/ext/oj/strict.c +187 -0
  63. data/oj-3.17.3/ext/oj/string_writer.c +517 -0
  64. data/oj-3.17.3/ext/oj/trace.c +72 -0
  65. data/oj-3.17.3/ext/oj/trace.h +55 -0
  66. data/oj-3.17.3/ext/oj/usual.c +1231 -0
  67. data/oj-3.17.3/ext/oj/usual.h +69 -0
  68. data/oj-3.17.3/ext/oj/util.c +136 -0
  69. data/oj-3.17.3/ext/oj/util.h +20 -0
  70. data/oj-3.17.3/ext/oj/val_stack.c +101 -0
  71. data/oj-3.17.3/ext/oj/val_stack.h +151 -0
  72. data/oj-3.17.3/ext/oj/validate.c +46 -0
  73. data/oj-3.17.3/ext/oj/wab.c +586 -0
  74. data/oj-3.17.3/lib/oj/active_support_helper.rb +39 -0
  75. data/oj-3.17.3/lib/oj/bag.rb +95 -0
  76. data/oj-3.17.3/lib/oj/easy_hash.rb +52 -0
  77. data/oj-3.17.3/lib/oj/error.rb +21 -0
  78. data/oj-3.17.3/lib/oj/json.rb +188 -0
  79. data/oj-3.17.3/lib/oj/mimic.rb +301 -0
  80. data/oj-3.17.3/lib/oj/saj.rb +80 -0
  81. data/oj-3.17.3/lib/oj/schandler.rb +143 -0
  82. data/oj-3.17.3/lib/oj/state.rb +135 -0
  83. data/oj-3.17.3/lib/oj/version.rb +4 -0
  84. data/oj-3.17.3/lib/oj.rb +15 -0
  85. data/oj-3.17.3/pages/Advanced.md +22 -0
  86. data/oj-3.17.3/pages/Compatibility.md +25 -0
  87. data/oj-3.17.3/pages/Custom.md +23 -0
  88. data/oj-3.17.3/pages/Encoding.md +65 -0
  89. data/oj-3.17.3/pages/InstallOptions.md +20 -0
  90. data/oj-3.17.3/pages/JsonGem.md +94 -0
  91. data/oj-3.17.3/pages/Modes.md +161 -0
  92. data/oj-3.17.3/pages/Options.md +337 -0
  93. data/oj-3.17.3/pages/Parser.md +309 -0
  94. data/oj-3.17.3/pages/Rails.md +167 -0
  95. data/oj-3.17.3/pages/Security.md +20 -0
  96. data/oj-3.17.3/pages/WAB.md +13 -0
  97. metadata +136 -0
@@ -0,0 +1,161 @@
1
+ # Oj Modes
2
+
3
+ Oj uses modes to switch the load and dump behavior. Initially Oj supported on
4
+ the :object mode which uses a format that allows Ruby object encoding and
5
+ decoding in a manner that lets almost any Ruby object be encoded and decoded
6
+ without monkey patching the object classes. From that start other demands were
7
+ made the were best met by giving Oj multiple modes of operation. The current
8
+ modes are:
9
+
10
+ - `:strict`
11
+ - `:null`
12
+ - `:compat` or `:json`
13
+ - `:rails`
14
+ - `:object`
15
+ - `:custom`
16
+
17
+ Since modes determine what the JSON output will look like and alternatively
18
+ what Oj expects when the `Oj.load()` method is called, mixing the output and
19
+ input mode formats will most likely not behave as intended. If the object mode
20
+ is used for producing JSON then use object mode for reading. The same is true
21
+ for each mode. It is possible to mix but only for advanced users.
22
+
23
+ ## :strict Mode
24
+
25
+ Strict mode follows the JSON specifications and only supports the JSON native
26
+ types, Boolean, nil, String, Hash, Array, and Numbers are encoded as
27
+ expected. Encountering any other type causes an Exception to be raised. This
28
+ is the safest mode as it is just simple translation, no code outside Oj or the
29
+ core Ruby is execution on loading. Very few options are supported by this mode
30
+ other than formatting options.
31
+
32
+ ## :null Mode
33
+
34
+ Null mode is similar to the :strict mode except that a JSON null is inserted
35
+ if a non-native type is encountered instead of raising an Exception.
36
+
37
+ ## :compat or :json Mode
38
+
39
+ The `:compat` mode mimics the json gem. The json gem is built around the use
40
+ of the `to_json(*)` method defined for a class. Oj attempts to provide the
41
+ same functionality by being a drop in replacement with a few
42
+ exceptions. To universally replace many `JSON` methods with their faster Oj counterparts,
43
+ simply run `Oj.mimic_json`. [{file:JsonGem.md}](JsonGem.md) includes more details on
44
+ compatibility and use.
45
+
46
+ ## :rails Mode
47
+
48
+ The `:rails` mode mimics the ActiveSupport version 5 encoder. Rails and
49
+ ActiveSupport are built around the use of the `as_json(*)` method defined for
50
+ a class. Oj attempts to provide the same functionality by being a drop in
51
+ replacement with a few exceptions. [{file:Rails.md}](Rails.md) includes
52
+ more details on compatibility and use.
53
+
54
+ ## :object Mode
55
+
56
+ Object mode is for fast Ruby object serialization and deserialization. That
57
+ was the primary purpose of Oj when it was first developed. As such it is the
58
+ default mode unless changed in the Oj default options. In :object mode Oj
59
+ generates JSON that follows conventions which allow Class and other
60
+ information such as Object IDs for circular reference detection to be encoded
61
+ in a JSON document. The formatting follows the rules describe on the
62
+ [{file:Encoding.md}](Encoding.md) page.
63
+
64
+ ## :custom Mode
65
+
66
+ Custom mode honors all options. It provides the most flexibility although it
67
+ can not be configured to be exactly like any of the other modes. Each mode has
68
+ some special aspect that makes it unique. For example, the `:object` mode has
69
+ it's own unique format for object dumping and loading. The `:compat` mode
70
+ mimic the json gem including methods called for encoding and inconsistencies
71
+ between `JSON.dump()`, `JSON.generate()`, and `JSON()`. More details on the
72
+ [{file:Custom.md}](Custom.md) page.
73
+
74
+ ## :wab Mode
75
+
76
+ WAB mode ignores all options except the indent option. Performance of this
77
+ mode is on slightly better than the :strict and :null modes. It is included to
78
+ support the [WABuR](https://github.com/ohler55/wabur) project. More details on
79
+ the [{file:WAB.md}](WAB.md) page.
80
+
81
+ ## Options Matrix
82
+
83
+ Not all options are available in all modes. The options matrix identifies the
84
+ options available in each mode. An `x` in the matrix indicates the option is
85
+ supported in that mode. A number indicates the footnotes describe additional
86
+ information.
87
+
88
+ | Option | type | :null | :strict | :compat | :rails | :object | :custom | :wab |
89
+ | ---------------------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |
90
+ | :allow_blank | Boolean | | | 1 | 1 | | x | |
91
+ | :allow_gc | Boolean | x | x | x | x | x | x | |
92
+ | :allow_invalid_unicode | Boolean | | | | | x | x | |
93
+ | :allow_nan | Boolean | | | x | | x | x | |
94
+ | :array_class | Class | | | x | x | | x | |
95
+ | :array_nl | String | | | | | | x | |
96
+ | :ascii_only | Boolean | x | x | 2 | 2 | x | x | |
97
+ | :auto_define | Boolean | | | | | x | x | |
98
+ | :bigdecimal_as_decimal | Boolean | | | | 3 | x | x | |
99
+ | :bigdecimal_load | Boolean | | | | | | x | |
100
+ | :compat_bigdecimal | Boolean | | | x | | | x | |
101
+ | :cache_keys | Boolean | x | x | x | x | | x | |
102
+ | :cache_strings | Fixnum | x | x | x | x | | x | |
103
+ | :circular | Boolean | x | x | x | x | x | x | |
104
+ | :class_cache | Boolean | | | | | x | x | |
105
+ | :create_additions | Boolean | | | x | x | | x | |
106
+ | :create_id | String | | | x | x | | x | |
107
+ | :empty_string | Boolean | | | | | | x | |
108
+ | :escape_mode | Symbol | | | | | | x | |
109
+ | :float_precision | Fixnum | x | x | | | | x | |
110
+ | :hash_class | Class | | | x | x | | x | |
111
+ | :ignore | Array | | | | | x | x | |
112
+ | :indent | Integer | x | x | 4 | 4 | x | x | x |
113
+ | :indent_str | String | | | x | x | | x | |
114
+ | :integer_range | Range | x | x | x | x | x | x | x |
115
+ | :match_string | Hash | | | x | x | | x | |
116
+ | :max_nesting | Fixnum | 5 | 5 | x | | 5 | 5 | |
117
+ | :mode | Symbol | - | - | - | - | - | - | |
118
+ | :nan | Symbol | | | | | | x | |
119
+ | :nilnil | Boolean | | | | | | x | |
120
+ | :object_class | Class | | | x | | | x | |
121
+ | :object_nl | String | | | x | x | | x | |
122
+ | :omit_nil | Boolean | x | x | x | x | x | x | |
123
+ | :quirks_mode | Boolean | | | 6 | | | x | |
124
+ | :safe | String | | | x | | | | |
125
+ | :second_precision | Fixnum | | | | | x | x | |
126
+ | :space | String | | | x | x | | x | |
127
+ | :space_before | String | | | x | x | | x | |
128
+ | :symbol_keys | Boolean | x | x | x | x | x | x | |
129
+ | :trace | Boolean | x | x | x | x | x | x | x |
130
+ | :time_format | Symbol | | | | | x | x | |
131
+ | :use_as_json | Boolean | | | | | | x | |
132
+ | :use_raw_json | Boolean | | | x | x | x | x | |
133
+ | :use_to_hash | Boolean | | | | | | x | |
134
+ | :use_to_json | Boolean | | | | | | x | |
135
+ --------------------------------------------------------------------------------------------------------
136
+
137
+ 1. :allow_blank an alias for :nilnil.
138
+
139
+ 2. The :ascii_only options is an undocumented json gem option.
140
+
141
+ 3. By default the bigdecimal_as decimal is not set and the default encoding
142
+ for Rails is as a string. Setting the value to true will encode a
143
+ BigDecimal as a number which breaks compatibility.
144
+ Note: after version 3.11.3 both `Oj.generate` and `JSON.generate`
145
+ will not honour this option in Rails Mode, detais on https://github.com/ohler55/oj/pull/716.
146
+
147
+ 4. The integer indent value in the default options will be honored by since
148
+ the json gem expects a String type the indent in calls to 'to_json()',
149
+ 'Oj.generate()', or 'Oj.generate_fast()' expect a String and not an
150
+ integer.
151
+
152
+ 5. The max_nesting option is for the json gem and rails only. It exists for
153
+ compatibility. For other Oj dump modes the maximum nesting is set to over
154
+ 1000. If reference loops exist in the object being dumped then using the
155
+ `:circular` option is a far better choice. It adds a slight overhead but
156
+ detects an object that appears more than once in a dump and does not dump
157
+ that object a second time.
158
+
159
+ 6. The quirks mode option is no longer supported in the most recent json
160
+ gem. It is supported by Oj for backward compatibility with older json gem
161
+ versions.
@@ -0,0 +1,337 @@
1
+ # Oj Options
2
+
3
+ To change default serialization mode use the following form. Attempting to
4
+ modify the Oj.default_options Hash directly will not set the changes on the
5
+ actual default options but on a copy of the Hash:
6
+
7
+ ```ruby
8
+ Oj.default_options = {:mode => :compat }
9
+ ```
10
+
11
+ Another way to make use of options when calling load or dump methods is to
12
+ pass in a Hash with the options already set in the Hash. This is slightly less
13
+ efficient than setting the globals for many smaller JSON documents but does
14
+ provide a more thread safe approach to using custom options for loading and
15
+ dumping.
16
+
17
+ ### Options for serializer and parser
18
+
19
+ ### :allow_blank [Boolean]
20
+
21
+ If true a nil input to load will return nil and not raise an Exception.
22
+
23
+ ### :allow_gc [Boolean]
24
+
25
+ Allow or prohibit GC during parsing, default is true (allow).
26
+
27
+ ### :allow_invalid_unicode [Boolean]
28
+
29
+ Allow invalid unicode, default is false (don't allow).
30
+
31
+ ### :allow_nan
32
+
33
+ Alias for the :nan option.
34
+
35
+ ### :array_class [Class]
36
+
37
+ Class to use instead of Array on load.
38
+
39
+ ### :array_nl
40
+
41
+ Trailer appended to the end of an array dump. The default is an empty
42
+ string. Primarily intended for json gem compatibility. Using just indent as an
43
+ integer gives better performance.
44
+
45
+ ### :ascii_only
46
+
47
+ If true all non-ASCII character are escaped when dumping. This is the same as
48
+ setting the :escape_mode options to :ascii and exists for json gem
49
+ compatibility.
50
+
51
+ ### :auto_define [Boolean]
52
+
53
+ Automatically define classes if they do not exist.
54
+
55
+ ### :bigdecimal_as_decimal [Boolean]
56
+
57
+ If true dump BigDecimal as a decimal number otherwise as a String
58
+
59
+ ### :bigdecimal_load [Symbol]
60
+
61
+ Determines how to load decimals.
62
+
63
+ - `:bigdecimal` convert all decimal numbers to BigDecimal.
64
+
65
+ - `:float` convert all decimal numbers to Float.
66
+
67
+ - `:auto` the most precise for the number of digits is used.
68
+
69
+ - `:fast` faster conversion to Float.
70
+
71
+ - `:ruby` convert to Float using the Ruby `to_f` conversion.
72
+
73
+ This can also be set with `:decimal_class` when used as a load or
74
+ parse option to match the JSON gem. In that case either `Float`,
75
+ `BigDecimal`, or `nil` can be provided.
76
+
77
+ ### :cache_keys [Boolean]
78
+
79
+ If true Hash keys are cached or interned. There are trade-offs with
80
+ caching keys. Large caches will use more memory and in extreme cases
81
+ (like over a million) the cache may be slower than not using
82
+ it. Repeated parsing of similar JSON docs is where cache_keys shines
83
+ especially with symbol keys.
84
+
85
+ There is a maximum length for cached keys. Any key longer than 34
86
+ bytes is not cached. Everything still works but the key is not cached.
87
+
88
+ ### :cache_strings [Int]
89
+
90
+ Shorter strings can be cached for better performance. A limit,
91
+ cache_strings, defines the upper limit on what strings are cached. As
92
+ with cached keys only strings less than 35 bytes are cached even if
93
+ the limit is set higher. Setting the limit to zero effectively
94
+ disables the caching of string values.
95
+
96
+ Note that caching for strings is for string values and not Hash keys
97
+ or Object attributes.
98
+
99
+ ### :circular [Boolean]
100
+
101
+ Detect circular references while dumping. In :compat mode raise a
102
+ NestingError. For other modes except the :object mode place a null in the
103
+ output. For :object mode place references in the output that will be used to
104
+ recreate the looped references on load.
105
+
106
+ ### :class_cache [Boolean]
107
+
108
+ Cache classes for faster parsing. This option should not be used if
109
+ dynamically modifying classes or reloading classes then don't use this.
110
+
111
+ ### :compat_bigdecimal [Boolean]
112
+
113
+ Determines how to load decimals when in `:compat` mode.
114
+
115
+ - `true` convert all decimal numbers to BigDecimal.
116
+
117
+ - `false` convert all decimal numbers to Float.
118
+
119
+ ### :create_additions
120
+
121
+ A flag indicating that the :create_id key, when encountered during parsing,
122
+ should create an Object matching the class name specified in the value
123
+ associated with the key.
124
+
125
+ ### :create_id [String]
126
+
127
+ The :create_id option specifies that key is used for dumping and loading when
128
+ specifying the class for an encoded object. The default is `json_create`.
129
+
130
+ In the `:custom` mode, setting the `:create_id` to nil will cause Complex,
131
+ Rational, Range, and Regexp to be output as strings instead of as JSON
132
+ objects.
133
+
134
+ ### :empty_string [Boolean]
135
+
136
+ If true an empty or all whitespace input will not raise an Exception. The
137
+ default_options will be honored for :null, :strict, and :custom modes. Ignored
138
+ for :custom and :wab. The :compat has a more complex set of rules. The JSON
139
+ gem compatibility is best described by examples.
140
+
141
+ ```
142
+ JSON.parse('') => raise
143
+ JSON.parse(' ') => raise
144
+ JSON.load('') => nil
145
+ JSON.load('', nil, allow_blank: false) => raise
146
+ JSON.load('', nil, allow_blank: true) => nil
147
+ JSON.load(' ') => raise
148
+ JSON.load(' ', nil, allow_blank: false) => raise
149
+ JSON.load(' ', nil, allow_blank: true) => raise
150
+ ```
151
+
152
+ ### :escape_mode [Symbol]
153
+
154
+ Determines the characters to escape when dumping. Only the :ascii and
155
+ :json modes are supported in :compat mode.
156
+
157
+ - `:newline` allows unescaped newlines in the output.
158
+
159
+ - `:json` follows the JSON specification. This is the default mode.
160
+
161
+ - `:slash` escapes `/` characters.
162
+
163
+ - `:xss_safe` escapes HTML and XML characters such as `&` and `<`.
164
+
165
+ - `:ascii` escapes all non-ascii or characters with the hi-bit set.
166
+
167
+ - `:unicode_xss` escapes a special unicodes and is xss safe.
168
+
169
+ ### :float_precision [Fixnum]
170
+
171
+ The number of digits of precision when dumping floats, 0 indicates use Ruby directly.
172
+
173
+ ### :hash_class [Class]
174
+
175
+ Class to use instead of Hash on load. This is the same as the :object_class.
176
+
177
+ ### :ignore [Array]
178
+
179
+ Ignore all the classes in the Array when dumping. A value of nil indicates
180
+ ignore nothing.
181
+
182
+ ### :indent [Fixnum]
183
+
184
+ Number of spaces to indent each element in a JSON document, zero is no newline
185
+ between JSON elements, negative indicates no newline between top level JSON
186
+ elements in a stream.
187
+
188
+ ### :indent_str
189
+
190
+ Indentation for each element when dumping. The default is an empty
191
+ string. Primarily intended for json gem compatibility. Using just indent as an
192
+ integer gives better performance.
193
+
194
+ ### :integer_range [Range]
195
+
196
+ Dump integers outside range as strings.
197
+ Note: range bounds must be Fixnum.
198
+
199
+ ### :match_string
200
+
201
+ Provides a means to detect strings that should be used to create non-String
202
+ objects. The value to the option must be a Hash with keys that are regular
203
+ expressions and values are class names. For strict json gem compatibility a
204
+ RegExp should be used. For better performance but sacrificing some regexp
205
+ options a string can be used and the C version of regex will be used instead.
206
+
207
+ ### :max_nesting
208
+
209
+ The maximum nesting depth on both dump and load that is allowed. This exists
210
+ for json gem compatibility.
211
+
212
+ ### :mode [Symbol]
213
+
214
+ Primary behavior for loading and dumping. The :mode option controls which
215
+ other options are in effect. For more details see the {file:Modes.md} page. By
216
+ default Oj uses the :custom mode which is provides the highest degree of
217
+ customization.
218
+
219
+ ### :nan [Symbol]
220
+
221
+ How to dump Infinity, -Infinity, and NaN in :null, :strict, and :compat
222
+ mode. Default is :auto but is ignored in the :compat and :rails modes.
223
+
224
+ - `:null` places a null
225
+
226
+ - `:huge` places a huge number
227
+
228
+ - `:word` places Infinity or NaN
229
+
230
+ - `:raise` raises and exception
231
+
232
+ - `:auto` uses default for each mode which are `:raise` for `:strict`, `:null` for `:null`, and `:word` for `:compat`.
233
+
234
+ ### :nilnil [Boolean]
235
+
236
+ If true a nil input to load will return nil and not raise an Exception.
237
+
238
+ ### :object_class
239
+
240
+ The class to use when creating a Hash on load instead of the Hash class.
241
+
242
+ ### :object_nl
243
+
244
+ Trailer appended to the end of an object dump. The default is an empty
245
+ string. Primarily intended for json gem compatibility. Using just indent as an
246
+ integer gives better performance.
247
+
248
+ ### :omit_nil [Boolean]
249
+
250
+ If true, Hash and Object attributes with nil values are omitted.
251
+
252
+ ### :quirks_mode [Boolean]
253
+
254
+ Allow single JSON values instead of documents, default is true (allow). This
255
+ can also be used in :compat mode to be backward compatible with older versions
256
+ of the json gem.
257
+
258
+ ### :safe
259
+
260
+ The JSON gem includes the complete JSON in parse errors with no limit
261
+ on size. To break from the JSON gem behavior for this case set `:safe`
262
+ to true.
263
+
264
+ ### :second_precision [Fixnum]
265
+
266
+ The number of digits after the decimal when dumping the seconds of time.
267
+
268
+ ### :skip_null_byte [Boolean]
269
+
270
+ If true, null bytes in strings will be omitted when dumping.
271
+
272
+ ### :space
273
+
274
+ String inserted after the ':' character when dumping a JSON object. The
275
+ default is an empty string. Primarily intended for json gem
276
+ compatibility. Using just indent as an integer gives better performance.
277
+
278
+ ### :space_before
279
+
280
+ String inserted before the ':' character when dumping a JSON object. The
281
+ default is an empty string. Primarily intended for json gem
282
+ compatibility. Using just indent as an integer gives better performance.
283
+
284
+ ### :symbol_keys [Boolean]
285
+
286
+ Use symbols instead of strings for hash keys.
287
+
288
+ ### :symbolize_names [Boolean]
289
+
290
+ Like :symbol_keys has keys are made into symbols but only when
291
+ mimicking the JSON gem and then only as the JSON gem honors it so
292
+ JSON.parse honors the option but JSON.load does not.
293
+
294
+ ### :trace
295
+
296
+ When true dump and load functions are traced by printing beginning and ending
297
+ of blocks and of specific calls.
298
+
299
+ ### :time_format [Symbol]
300
+
301
+ The :time_format when dumping.
302
+
303
+ - `:unix` time is output as a decimal number in seconds since epoch including fractions of a second.
304
+
305
+ - `:unix_zone` is similar to the `:unix` format but with the timezone encoded in
306
+ the exponent of the decimal number of seconds since epoch.
307
+
308
+ - `:xmlschema` time is output as a string that follows the XML schema definition.
309
+
310
+ - `:ruby` time is output as a string formatted using the Ruby `to_s` conversion.
311
+
312
+ ### :use_as_json [Boolean]
313
+
314
+ Call `as_json()` methods on dump, default is false. The option is ignored in
315
+ the :compat and :rails modes.
316
+
317
+
318
+ ### :use_raw_json [Boolean]
319
+
320
+ Call `raw_json()` methods on dump, default is false. The option is
321
+ accepted in the :compat and :rails modes even though it is not
322
+ supported by other JSON gems. It provides a means to optimize dump or
323
+ generate performance. The `raw_json(depth, indent)` method should be
324
+ called only by Oj. It is not intended for any other use. This is meant
325
+ to replace the abused `to_json` methods. Calling `Oj.dump` inside the
326
+ `raw_json` with the object itself when `:use_raw_json` is true will
327
+ result in an infinite loop.
328
+
329
+ ### :use_to_hash [Boolean]
330
+
331
+ Call `to_hash()` methods on dump, default is false. The option is ignored in
332
+ the :compat and :rails modes.
333
+
334
+ ### :use_to_json [Boolean]
335
+
336
+ Call `to_json()` methods on dump, default is false. The option is ignored in
337
+ the :compat and :rails modes.