Module: MultiJSON::Options Private
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Mixin providing configurable parse/generate options
Supports static hashes or dynamic callables (procs/lambdas). Extended by both MultiJSON (global options) and Adapter classes.
Constant Summary collapse
- EMPTY_OPTIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Steep needs an inline ‘#:` annotation here because `{}.freeze` would be inferred as `Hash[untyped, untyped]` and trip `UnannotatedEmptyCollection`. The annotation requires `Hash.new.freeze` (not the `{}.freeze` rubocop would prefer) because the `#:` cast only applies to method-call results.
Hash.new.freeze
Instance Method Summary collapse
-
#default_dump_options ⇒ Hash
deprecated
private
Deprecated.
Use #default_generate_options instead. Will be removed in v2.0.
-
#default_generate_options ⇒ Hash
private
Get default generate options.
-
#default_load_options ⇒ Hash
deprecated
private
Deprecated.
Use #default_parse_options instead. Will be removed in v2.0.
-
#default_parse_options ⇒ Hash
private
Get default parse options.
-
#dump_options(*args) ⇒ Hash
deprecated
Deprecated.
Use #generate_options instead. Will be removed in v2.0.
-
#dump_options=(options) ⇒ Hash, Proc
deprecated
Deprecated.
Use #generate_options= instead. Will be removed in v2.0.
-
#generate_options(*args) ⇒ Hash
Get options for generate operations.
-
#generate_options=(options) ⇒ Hash, Proc
Set options for generate operations.
-
#load_options(*args) ⇒ Hash
deprecated
Deprecated.
Use #parse_options instead. Will be removed in v2.0.
-
#load_options=(options) ⇒ Hash, Proc
deprecated
Deprecated.
Use #parse_options= instead. Will be removed in v2.0.
-
#parse_options(*args) ⇒ Hash
Get options for parse operations.
-
#parse_options=(options) ⇒ Hash, Proc
Set options for parse operations.
Instance Method Details
#default_dump_options ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Use #default_generate_options instead. Will be removed in v2.0.
Get default generate options
155 156 157 |
# File 'lib/multi_json/options.rb', line 155 def end |
#default_generate_options ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get default generate options
81 82 83 |
# File 'lib/multi_json/options.rb', line 81 def Concurrency.synchronize(:default_options) { @default_generate_options ||= EMPTY_OPTIONS } end |
#default_load_options ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Use #default_parse_options instead. Will be removed in v2.0.
Get default parse options
146 147 148 |
# File 'lib/multi_json/options.rb', line 146 def end |
#default_parse_options ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get default parse options
73 74 75 |
# File 'lib/multi_json/options.rb', line 73 def Concurrency.synchronize(:default_options) { @default_parse_options ||= EMPTY_OPTIONS } end |
#dump_options(*args) ⇒ Hash
Use #generate_options instead. Will be removed in v2.0.
Get options for generate operations
135 136 137 138 139 |
# File 'lib/multi_json/options.rb', line 135 def (*args) MultiJSON.warn_deprecation_once(:dump_options, "MultiJSON.dump_options is deprecated and will be removed in v2.0. Use MultiJSON.generate_options instead.") (*args) end |
#dump_options=(options) ⇒ Hash, Proc
Use #generate_options= instead. Will be removed in v2.0.
Set options for generate operations
107 108 109 110 111 |
# File 'lib/multi_json/options.rb', line 107 def () MultiJSON.warn_deprecation_once(:dump_options=, "MultiJSON.dump_options= is deprecated and will be removed in v2.0. Use MultiJSON.generate_options= instead.") self. = end |
#generate_options(*args) ⇒ Hash
Get options for generate operations
65 66 67 |
# File 'lib/multi_json/options.rb', line 65 def (*args) (@generate_options, *args) || end |
#generate_options=(options) ⇒ Hash, Proc
Set options for generate operations
37 38 39 40 |
# File 'lib/multi_json/options.rb', line 37 def () OptionsCache.reset @generate_options = end |
#load_options(*args) ⇒ Hash
Use #parse_options instead. Will be removed in v2.0.
Get options for parse operations
121 122 123 124 125 |
# File 'lib/multi_json/options.rb', line 121 def (*args) MultiJSON.warn_deprecation_once(:load_options, "MultiJSON.load_options is deprecated and will be removed in v2.0. Use MultiJSON.parse_options instead.") (*args) end |
#load_options=(options) ⇒ Hash, Proc
Use #parse_options= instead. Will be removed in v2.0.
Set options for parse operations
93 94 95 96 97 |
# File 'lib/multi_json/options.rb', line 93 def () MultiJSON.warn_deprecation_once(:load_options=, "MultiJSON.load_options= is deprecated and will be removed in v2.0. Use MultiJSON.parse_options= instead.") self. = end |
#parse_options(*args) ⇒ Hash
Get options for parse operations
When ‘@parse_options` is a callable (proc/lambda), it’s invoked with ‘args` as positional arguments — typically the merged options hash from `Adapter.merged_parse_options`. When it’s a plain hash, ‘args` is ignored.
54 55 56 |
# File 'lib/multi_json/options.rb', line 54 def (*args) (@parse_options, *args) || end |
#parse_options=(options) ⇒ Hash, Proc
Set options for parse operations
25 26 27 28 |
# File 'lib/multi_json/options.rb', line 25 def () OptionsCache.reset @parse_options = end |