[ruby/json] Bring back the numerous deprecated alias
This time with explicit deprecation warnings. https://github.com/ruby/json/commit/0dee9bdad9
This commit is contained in:
parent
169b33d1d5
commit
2b5e1db2db
@ -919,6 +919,50 @@ module JSON
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# :stopdoc:
|
||||||
|
# All these were meant to be deprecated circa 2009, but were just set as undocumented
|
||||||
|
# so usage still exist in the wild.
|
||||||
|
def unparse(...)
|
||||||
|
if RUBY_VERSION >= "3.0"
|
||||||
|
warn "JSON.unparse is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1, category: :deprecated
|
||||||
|
else
|
||||||
|
warn "JSON.unparse is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1
|
||||||
|
end
|
||||||
|
generate(...)
|
||||||
|
end
|
||||||
|
module_function :unparse
|
||||||
|
|
||||||
|
def fast_unparse(...)
|
||||||
|
if RUBY_VERSION >= "3.0"
|
||||||
|
warn "JSON.fast_unparse is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1, category: :deprecated
|
||||||
|
else
|
||||||
|
warn "JSON.fast_unparse is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1
|
||||||
|
end
|
||||||
|
generate(...)
|
||||||
|
end
|
||||||
|
module_function :fast_unparse
|
||||||
|
|
||||||
|
def pretty_unparse(...)
|
||||||
|
if RUBY_VERSION >= "3.0"
|
||||||
|
warn "JSON.pretty_unparse is deprecated and will be removed in json 3.0.0, just use JSON.pretty_generate", uplevel: 1, category: :deprecated
|
||||||
|
else
|
||||||
|
warn "JSON.pretty_unparse is deprecated and will be removed in json 3.0.0, just use JSON.pretty_generate", uplevel: 1
|
||||||
|
end
|
||||||
|
pretty_generate(...)
|
||||||
|
end
|
||||||
|
module_function :fast_unparse
|
||||||
|
|
||||||
|
def restore(...)
|
||||||
|
if RUBY_VERSION >= "3.0"
|
||||||
|
warn "JSON.restore is deprecated and will be removed in json 3.0.0, just use JSON.load", uplevel: 1, category: :deprecated
|
||||||
|
else
|
||||||
|
warn "JSON.restore is deprecated and will be removed in json 3.0.0, just use JSON.load", uplevel: 1
|
||||||
|
end
|
||||||
|
load(...)
|
||||||
|
end
|
||||||
|
module_function :restore
|
||||||
|
# :startdoc:
|
||||||
|
|
||||||
# JSON::Coder holds a parser and generator configuration.
|
# JSON::Coder holds a parser and generator configuration.
|
||||||
#
|
#
|
||||||
# module MyApp
|
# module MyApp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user