underscorize_keys 0.0.1
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/underscorize_keys.rb +14 -0
- metadata +57 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4db5baee99127a0b5524ffbecb0e3e082f406212409c9348705f270b6a43f057
|
4
|
+
data.tar.gz: 680fe45525dce3f1a4b3d3a283f38ebcff4a0db6ce32e0ae28f3e9d5b7631ad3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c6138b79167a06fa6e7ea8abc79c2ea76605a0a010873aa5ca526ee7baf0019495f5893ad27b6ce9557078d235cfb45e967527b578b79951a95e067c2dc440ed
|
7
|
+
data.tar.gz: d5078633be9d9a876167829d644dab25355a8422700d39eaa56858ef62c0215d0ada3476a0d256094d2a954d3f683d7ca09632816f6615da43088241b744b180
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class UnderscorizeKeys
|
2
|
+
def self.do data
|
3
|
+
return unless data.is_a? Hash
|
4
|
+
data.transform_keys! &:to_s
|
5
|
+
data.transform_keys!{ |k| k.gsub(/(.)([A-Z])/,'\1_\2').downcase }
|
6
|
+
data.each do |x,y|
|
7
|
+
if y.is_a? Hash
|
8
|
+
self.do(y)
|
9
|
+
elsif y.is_a? Array
|
10
|
+
y.each{|z| self.do(z) if z.is_a?(Hash)}
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: underscorize_keys
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- shwetakale13@gmail.com
|
8
|
+
- tanmay711994@gmail.com
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2021-11-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.5'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '3.5'
|
28
|
+
description:
|
29
|
+
email:
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- lib/underscorize_keys.rb
|
35
|
+
homepage:
|
36
|
+
licenses: []
|
37
|
+
metadata: {}
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubygems_version: 3.2.3
|
54
|
+
signing_key:
|
55
|
+
specification_version: 4
|
56
|
+
summary: underscorize_keys convert all the keys of object to underscore
|
57
|
+
test_files: []
|