Skip to content

Commit

Permalink
Add descriptions of the missing options to document (#824)
Browse files Browse the repository at this point in the history
* Add document of `:fast` option in `:bigdecimal_load`

This option was introduced at 80bee00

* Add document of `:ruby` option in `:bigdecimal_load`

This option was introduced at 3c1c896

* Add document of `:slash` option in `:escape_mode`

This option was introduced at f1e7748

* Fix typo
  • Loading branch information
Watson1978 committed Nov 6, 2022
1 parent 24347a4 commit 13720f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/oj/oj.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,15 @@ struct _options oj_default_options = {
*references
* - *:auto_define* [_Boolean_|_nil_] automatically define classes if they do not exist
* - *:symbol_keys* [_Boolean_|_nil_] use symbols instead of strings for hash keys
* - *:escape_mode* [_:newline_|_:json_|_:xss_safe_|_:ascii_|_unicode_xss_|_nil_] determines the
* - *:escape_mode* [_:newline_|_:json_|_:slash_|_:xss_safe_|_:ascii_|_:unicode_xss_|_nil_] determines the
*characters to escape
* - *:class_cache* [_Boolean_|_nil_] cache classes for faster parsing (if dynamically modifying
*classes or reloading classes then don't use this)
* - *:mode* [_:object_|_:strict_|_:compat_|_:null_|_:custom_|_:rails_|_:wab_] load and dump modes
*to use for JSON
* - *:time_format* [_:unix_|_:unix_zone_|_:xmlschema_|_:ruby_] time format when dumping
* - *:bigdecimal_as_decimal* [_Boolean_|_nil_] dump BigDecimal as a decimal number or as a String
* - *:bigdecimal_load* [_:bigdecimal_|_:float_|_:auto_|_:fast_] load decimals as BigDecimal instead
* - *:bigdecimal_load* [_:bigdecimal_|_:float_|_:auto_|_:fast_|_:ruby_] load decimals as BigDecimal instead
*of as a Float. :auto pick the most precise for the number of digits. :float should be the same as
*ruby. :fast may require rounding but is must faster.
* - *:compat_bigdecimal* [_true_|_false_] load decimals as BigDecimal instead of as a Float when in
Expand Down
6 changes: 6 additions & 0 deletions pages/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ Determines how to load decimals.

- `:auto` the most precise for the number of digits is used.

- `:fast` faster conversion to Float.

- `:ruby` convert to Float using the Ruby `to_f` conversion.

This can also be set with `:decimal_class` when used as a load or
parse option to match the JSON gem. In that case either `Float`,
`BigDecimal`, or `nil` can be provided.
Expand Down Expand Up @@ -154,6 +158,8 @@ Determines the characters to escape when dumping. Only the :ascii and

- `:json` follows the JSON specification. This is the default mode.

- `:slash` escapes `/` characters.

- `:xss_safe` escapes HTML and XML characters such as `&` and `<`.

- `:ascii` escapes all non-ascii or characters with the hi-bit set.
Expand Down

0 comments on commit 13720f6

Please sign in to comment.