summaryrefslogtreecommitdiff
path: root/ext/json
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-03-27 09:54:51 +0100
committerHiroshi SHIBATA <[email protected]>2025-03-28 12:44:53 +0900
commit2b9a9300ac4cb00824d59e59f6671a77cc003a1f (patch)
tree2fb5dd72001ab987f16a9cf193eafbac7936191a /ext/json
parent589713bcb5cf4b52278a2cd6074d37c897dc79fc (diff)
[ruby/json] Deprecate `JSON.fast_generate`
https://github.com/ruby/json/commit/6508455d82
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13004
Diffstat (limited to 'ext/json')
-rw-r--r--ext/json/lib/json/common.rb18
1 files changed, 4 insertions, 14 deletions
diff --git a/ext/json/lib/json/common.rb b/ext/json/lib/json/common.rb
index b2f11afe55..c9f6d7505b 100644
--- a/ext/json/lib/json/common.rb
+++ b/ext/json/lib/json/common.rb
@@ -74,16 +74,6 @@ module JSON
$VERBOSE = old
end
- def create_fast_state
- State.new(
- :indent => '',
- :space => '',
- :object_nl => "",
- :array_nl => "",
- :max_nesting => false
- )
- end
-
def create_pretty_state
State.new(
:indent => ' ',
@@ -368,12 +358,12 @@ module JSON
# # Raises SystemStackError (stack level too deep):
# JSON.fast_generate(a)
def fast_generate(obj, opts = nil)
- if State === opts
- state = opts
+ if RUBY_VERSION >= "3.0"
+ warn "JSON.fast_generate is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1, category: :deprecated
else
- state = JSON.create_fast_state.configure(opts)
+ warn "JSON.fast_generate is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1
end
- state.generate(obj)
+ generate(obj, opts)
end
# :call-seq: