json_sorted 0.0.1 → 0.0.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/lib/json_sorted.rb +25 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 202a8232906030e57f4a11053d9f778376384754eb4fe70c4cc772cd8f2b9768
|
4
|
+
data.tar.gz: fc1b64a6107f13d98c6c4fe7ded6d0c60d5ff8caea884b7670c0eb2ed04d65dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 733332cc2a65a15cbda6b8e389c661d90e305cae2cb8d6723fe034ebc4cf5569ab953c74ea0725c3aacb1133625097ca39e2566b2b77818f72933da22e212b3e
|
7
|
+
data.tar.gz: 7e57ae3d6b5daa868ecc263c38a178a450719e9a925b8eacdc3b8dd71e3e9b68f1ecf2872b7dd0263538d056549e94fb7bad508cf7aaa175e44e29970a08bade
|
data/lib/json_sorted.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "set"
|
1
2
|
require "json"
|
2
3
|
|
3
4
|
class Hash
|
@@ -5,3 +6,27 @@ class Hash
|
|
5
6
|
JSON.generate(sort.to_h)
|
6
7
|
end
|
7
8
|
end
|
9
|
+
|
10
|
+
class Array
|
11
|
+
def to_json
|
12
|
+
JSON.generate(sort)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class String
|
17
|
+
def to_json
|
18
|
+
JSON.generate(self).to_sym.to_s
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Time
|
23
|
+
def to_json
|
24
|
+
JSON.generate(to_s)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class Set
|
29
|
+
def to_json
|
30
|
+
JSON.generate(sort)
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_sorted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Stefan Ort
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ensure sorting of keys in JSON generated from Hash objects
|
14
14
|
email: pso@pso.io
|