hashconverter 1.0.0
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 +7 -0
- data/lib/hashconverter.rb +29 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ce2b7a21e97d89fb79f0a0cb87cc85afe1cd64f0abbd51723d24df62649dd922
|
4
|
+
data.tar.gz: ef967932abadcb641ee2434e88ec7c3c525ed1946b84e2ab34262c666f425de6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6851fbb3d34d3bf0201cf60aadd374c96a9d910b67a5b5cce3d16c69b58d24fc2dac3362cf4fc8e5fd47d13a0d33b2ada89d7b61077454a0e7ba6ab381307dc1
|
7
|
+
data.tar.gz: 31b6060235f1f00963a6b673bee3f4e11477872936942aa6f8791d7c33f0c2394886f279f13ad6f4667c76bba5e88e3c663f758b544e2cd79a23938da74cfbb6
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class ::Hash
|
2
|
+
# via https://stackoverflow.com/a/25835016/2257038
|
3
|
+
def stringify_keys
|
4
|
+
h = self.map do |k,v|
|
5
|
+
v_str = if v.instance_of? Hash
|
6
|
+
v.stringify_keys
|
7
|
+
else
|
8
|
+
v
|
9
|
+
end
|
10
|
+
|
11
|
+
[k.to_s, v_str]
|
12
|
+
end
|
13
|
+
Hash[h]
|
14
|
+
end
|
15
|
+
|
16
|
+
# via https://stackoverflow.com/a/25835016/2257038
|
17
|
+
def symbol_keys
|
18
|
+
h = self.map do |k,v|
|
19
|
+
v_sym = if v.instance_of? Hash
|
20
|
+
v.symbol_keys
|
21
|
+
else
|
22
|
+
v
|
23
|
+
end
|
24
|
+
|
25
|
+
[k.to_sym, v_sym]
|
26
|
+
end
|
27
|
+
Hash[h]
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hashconverter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- AtomicLemon
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-06-13 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Symbolize and Stringify Ruby hashes
|
14
|
+
email: enzo@premiumllc.net
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/hashconverter.rb
|
20
|
+
homepage: https://rubygems.org/gems/hashconverter
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubygems_version: 3.0.8
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: Converts Ruby hashes
|
43
|
+
test_files: []
|