json 2.11.0 → 2.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +11 -0
- data/lib/json/common.rb +62 -0
- data/lib/json/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 747a457b1988cb2f8b166b6e0c228a3dca50b90a120a9128f815c4c18fb9f450
|
4
|
+
data.tar.gz: cc3c446db01177c9f7fbc6409d19e69bebce3845c77a7e8a3542c783a728d8b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea235083ce6d28a891ca4b583a7cb36641e736bc776a7039ff59c919e21e5d3eae4b2baf254dc190de003cccc62a1e7a03ada668c97f3226c154d1e76a35b307
|
7
|
+
data.tar.gz: 4818eaff0e54ef1402253bdca221c1262257314131733ac678338c8d8c8d447052dcf11205e309573b32ea9354717d3c485011739c8a7ab4c12af3391d7e2500
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
### 2025-04-24 (2.11.2)
|
4
|
+
|
5
|
+
* Add back `JSON::PRETTY_STATE_PROTOTYPE`. This constant was private API but is used by popular gems like `multi_json`.
|
6
|
+
It now emits a deprecation warning.
|
7
|
+
|
8
|
+
### 2025-04-24 (2.11.1)
|
9
|
+
|
10
|
+
* Add back `JSON.restore`, `JSON.unparse`, `JSON.fast_unparse` and `JSON.pretty_unparse`.
|
11
|
+
These were deprecated 16 years ago, but never emited warnings, only undocumented, so are
|
12
|
+
still used by a few gems.
|
13
|
+
|
3
14
|
### 2025-04-24 (2.11.0)
|
4
15
|
|
5
16
|
* Optimize Integer generation to be ~1.8x faster.
|
data/lib/json/common.rb
CHANGED
@@ -919,6 +919,68 @@ module JSON
|
|
919
919
|
end
|
920
920
|
end
|
921
921
|
|
922
|
+
# :stopdoc:
|
923
|
+
# All these were meant to be deprecated circa 2009, but were just set as undocumented
|
924
|
+
# so usage still exist in the wild.
|
925
|
+
def unparse(...)
|
926
|
+
if RUBY_VERSION >= "3.0"
|
927
|
+
warn "JSON.unparse is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1, category: :deprecated
|
928
|
+
else
|
929
|
+
warn "JSON.unparse is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1
|
930
|
+
end
|
931
|
+
generate(...)
|
932
|
+
end
|
933
|
+
module_function :unparse
|
934
|
+
|
935
|
+
def fast_unparse(...)
|
936
|
+
if RUBY_VERSION >= "3.0"
|
937
|
+
warn "JSON.fast_unparse is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1, category: :deprecated
|
938
|
+
else
|
939
|
+
warn "JSON.fast_unparse is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1
|
940
|
+
end
|
941
|
+
generate(...)
|
942
|
+
end
|
943
|
+
module_function :fast_unparse
|
944
|
+
|
945
|
+
def pretty_unparse(...)
|
946
|
+
if RUBY_VERSION >= "3.0"
|
947
|
+
warn "JSON.pretty_unparse is deprecated and will be removed in json 3.0.0, just use JSON.pretty_generate", uplevel: 1, category: :deprecated
|
948
|
+
else
|
949
|
+
warn "JSON.pretty_unparse is deprecated and will be removed in json 3.0.0, just use JSON.pretty_generate", uplevel: 1
|
950
|
+
end
|
951
|
+
pretty_generate(...)
|
952
|
+
end
|
953
|
+
module_function :fast_unparse
|
954
|
+
|
955
|
+
def restore(...)
|
956
|
+
if RUBY_VERSION >= "3.0"
|
957
|
+
warn "JSON.restore is deprecated and will be removed in json 3.0.0, just use JSON.load", uplevel: 1, category: :deprecated
|
958
|
+
else
|
959
|
+
warn "JSON.restore is deprecated and will be removed in json 3.0.0, just use JSON.load", uplevel: 1
|
960
|
+
end
|
961
|
+
load(...)
|
962
|
+
end
|
963
|
+
module_function :restore
|
964
|
+
|
965
|
+
class << self
|
966
|
+
private
|
967
|
+
|
968
|
+
def const_missing(const_name)
|
969
|
+
case const_name
|
970
|
+
when :PRETTY_STATE_PROTOTYPE
|
971
|
+
if RUBY_VERSION >= "3.0"
|
972
|
+
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
|
973
|
+
else
|
974
|
+
warn "JSON::PRETTY_STATE_PROTOTYPE is deprecated and will be removed in json 3.0.0, just use JSON.pretty_generate", uplevel: 1
|
975
|
+
end
|
976
|
+
state.new(PRETTY_GENERATE_OPTIONS)
|
977
|
+
else
|
978
|
+
super
|
979
|
+
end
|
980
|
+
end
|
981
|
+
end
|
982
|
+
# :startdoc:
|
983
|
+
|
922
984
|
# JSON::Coder holds a parser and generator configuration.
|
923
985
|
#
|
924
986
|
# module MyApp
|
data/lib/json/version.rb
CHANGED