[ruby/json] Bring back JSON::PRETTY_STATE_PROTOTYPE with a deprecation
Fix: https://github.com/ruby/json/issues/788 `multi_json` rely on it, even though it was never documented as public API. Bringing it back as a method so it can emit a deprecation warning. https://github.com/ruby/json/commit/123121bba2
This commit is contained in:
parent
1d65d5ce47
commit
05f949ebbf
@ -961,6 +961,24 @@ module JSON
|
||||
load(...)
|
||||
end
|
||||
module_function :restore
|
||||
|
||||
class << self
|
||||
private
|
||||
|
||||
def const_missing(const_name)
|
||||
case const_name
|
||||
when :PRETTY_STATE_PROTOTYPE
|
||||
if RUBY_VERSION >= "3.0"
|
||||
warn "JSON::PRETTY_STATE_PROTOTYPE is deprecated and will be removed in json 3.0.0, just use JSON.pretty_generate", uplevel: 1, category: :deprecated
|
||||
else
|
||||
warn "JSON::PRETTY_STATE_PROTOTYPE is deprecated and will be removed in json 3.0.0, just use JSON.pretty_generate", uplevel: 1
|
||||
end
|
||||
state.new(PRETTY_GENERATE_OPTIONS)
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
# :startdoc:
|
||||
|
||||
# JSON::Coder holds a parser and generator configuration.
|
||||
|
Loading…
x
Reference in New Issue
Block a user