camel_snake_keys 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -3
- data/CHANGELOG.md +8 -0
- data/lib/camel_snake_keys.rb +4 -4
- data/lib/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: aa1c9add7284fe62b15cee14c52d235fec33afcef807443b16e3707968637a8f
|
4
|
+
data.tar.gz: 232f5192defb1ca29e6a5d0be7167d2da77022d821df89d198edcc9f4e77db40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47b49b0cc1b7ac5bf0ef0a0b7ee8e8e4c5b0f20d302c22e852fbecadf140c37a6cc1997220b0e65a48ec9ef180bc95dc2b9edc27f2fb08a9a619cdce282f3da8
|
7
|
+
data.tar.gz: 52c3a13f86946c9dc122503fb0b2473930a5c09fd6a58c3a35e7c5af04c7f69358f686d591cb084012f36d6da944722fad854809003fdd70f98253966d9df1cf
|
data/.gitignore
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.0
|
data/.travis.yml
CHANGED
@@ -11,9 +11,9 @@ rvm:
|
|
11
11
|
- 2.2
|
12
12
|
- 2.1
|
13
13
|
- 2.0.0
|
14
|
-
- jruby-9.0.
|
14
|
+
# - jruby-9.1.0.0
|
15
15
|
- ruby-head
|
16
|
-
|
16
|
+
# - jruby-head
|
17
17
|
|
18
18
|
matrix:
|
19
19
|
allow_failures:
|
@@ -27,7 +27,7 @@ env:
|
|
27
27
|
- RAILS=4.2.7.1
|
28
28
|
- RAILS=master
|
29
29
|
global:
|
30
|
-
- JRUBY_OPTS="-J-Xmx1024m --debug"
|
30
|
+
# - JRUBY_OPTS="-J-Xmx1024m --debug"
|
31
31
|
|
32
32
|
notifications:
|
33
33
|
email:
|
data/CHANGELOG.md
CHANGED
data/lib/camel_snake_keys.rb
CHANGED
@@ -37,9 +37,9 @@ module CamelSnakeKeys
|
|
37
37
|
|
38
38
|
def snake_keys(data, indifference=false)
|
39
39
|
if data.kind_of? Array
|
40
|
-
data.map { |v| snake_keys(v) }
|
40
|
+
data.map { |v| snake_keys(v, indifference) }
|
41
41
|
elsif data.kind_of? Hash
|
42
|
-
hash = Hash[data.sort_by {|k,_v| k =~ /_/ ? 0 : 1 }.map {|k, v| [if_underscore(k), snake_keys(v)] }]
|
42
|
+
hash = Hash[data.sort_by {|k,_v| k =~ /_/ ? 0 : 1 }.map {|k, v| [if_underscore(k), snake_keys(v, indifference)] }]
|
43
43
|
hash = hash.with_indifferent_access if indifference
|
44
44
|
data.class == Hash ? hash : data.class.new(hash)
|
45
45
|
else
|
@@ -49,9 +49,9 @@ module CamelSnakeKeys
|
|
49
49
|
|
50
50
|
def camel_keys(data, indifference=false)
|
51
51
|
if data.kind_of? Array
|
52
|
-
data.map { |v| camel_keys(v) }
|
52
|
+
data.map { |v| camel_keys(v, indifference) }
|
53
53
|
elsif data.kind_of? Hash
|
54
|
-
hash = Hash[data.sort_by {|k,_v| k =~ /_/ ? 1 : 0 }.map {|k, v| [if_camelize(k), camel_keys(v)] }]
|
54
|
+
hash = Hash[data.sort_by {|k,_v| k =~ /_/ ? 1 : 0 }.map {|k, v| [if_camelize(k), camel_keys(v, indifference)] }]
|
55
55
|
hash = hash.with_indifferent_access if indifference
|
56
56
|
data.class == Hash ? hash : data.class.new(hash)
|
57
57
|
else
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camel_snake_keys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Buermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- ".coveralls.yml"
|
63
63
|
- ".gitignore"
|
64
64
|
- ".rubocop.yml"
|
65
|
+
- ".ruby-version"
|
65
66
|
- ".travis.yml"
|
66
67
|
- CHANGELOG.md
|
67
68
|
- Gemfile
|
@@ -91,8 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
92
|
- !ruby/object:Gem::Version
|
92
93
|
version: '0'
|
93
94
|
requirements: []
|
94
|
-
|
95
|
-
rubygems_version: 2.6.10
|
95
|
+
rubygems_version: 3.1.2
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: Convert nested data structure hash keys between camel and snake case.
|