deep_hash_transformer 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17f7965aec4168e642da43b3a20b7e051bee4cf7bbf7c4b56384271a0f8bdf01
4
- data.tar.gz: f390e181624819cf546f27c46bb0ec8e1181aea60003729d87a5b5e0e57611be
3
+ metadata.gz: a7f171270350f94fdce54754d2cd72e7832b50d96fd92255e7c0ccf2b4a4460b
4
+ data.tar.gz: bfbe82ac975f7a38f21a26ffd969fb226592ec67e4d54c6009213ad56883e146
5
5
  SHA512:
6
- metadata.gz: 59ec3c08be71f8f7bbe55012ddd9440072e931f846274db1b853fb29a8693c4f09070f79565790d515fd118e044cc8c996523a0b6a56edcb896aedd77382883c
7
- data.tar.gz: aab2d5198326690055f97d018cf1256e1ad9794850729415c5e5f1d723fa30f818e670488f685c086e7de30a2b72a22cd4906dc248309f79adea2b58df41d383
6
+ metadata.gz: 3c2b9b9c03df98e7407c1ff2e365b2b49a5e200380b1a3747be28d3bcdb8832be8c59c5b94db2753b93809549d7841da2bf1e0a9d6bb425c1c9f545802bea830
7
+ data.tar.gz: cab7709f4bf6dbb2a3c9d692c0d3bb4af83b4ce318a020624ad7151c7e1d71f40dde2dec2df51326d79e0f9ae7f2a97c72ba11c65c38467e3e617d26bb572d1f
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'deep_hash_transformer/version'
2
4
 
3
5
  class DeepHashTransformer
4
6
  OPS = {
5
- dasherize: ->(val) { val.to_s.tr('_'.freeze, '-'.freeze) },
6
- identity: ->(val) { val },
7
- stringify: ->(val) { val.to_s },
8
- symbolize: ->(val) { val.to_sym },
9
- underscore: ->(val) { val.to_s.tr('-'.freeze, '_'.freeze) }
7
+ dasherize: ->(val) { val.to_s.tr('_', '-') },
8
+ identity: ->(val) { val },
9
+ stringify: ->(val) { val.to_s },
10
+ symbolize: ->(val) { val.to_sym },
11
+ underscore: ->(val) { val.to_s.tr('-', '_') }
10
12
  }.freeze
11
13
 
12
14
  def initialize(hash)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class DeepHashTransformer
2
- VERSION = '1.0.0'.freeze
4
+ VERSION = '2.0.0'
3
5
  end
@@ -1,41 +1,43 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe DeepHashTransformer do
2
- let(:hash) do
3
- {
4
+ subject do
5
+ described_class.new(
4
6
  Integer => 123,
5
7
  :foobar => { bar: 'bar' },
6
8
  'aa_zz' => [{ 'bar' => :bar, 'a-z' => 'a-z' }]
7
- }
9
+ )
8
10
  end
9
11
 
10
12
  describe '#tr with `:underscore, :symbolize`' do
11
- subject { DeepHashTransformer.new(hash).tr(:underscore, :symbolize) }
13
+ subject { super().tr(:underscore, :symbolize) }
12
14
 
13
15
  it do
14
- is_expected.to eq(
16
+ expect(subject).to eq( # rubocop:disable RSpec/NamedSubject
15
17
  Integer => 123,
16
18
  :foobar => { bar: 'bar' },
17
- :aa_zz => [{ bar: :bar, a_z: 'a-z' }]
19
+ :aa_zz => [{ bar: :bar, a_z: 'a-z' }]
18
20
  )
19
21
  end
20
22
  end
21
23
 
22
24
  describe '#dasherize' do
23
- subject { DeepHashTransformer.new(hash).dasherize }
25
+ subject { super().dasherize }
24
26
 
25
27
  it do
26
- is_expected.to eq(
28
+ expect(subject).to eq( # rubocop:disable RSpec/NamedSubject
27
29
  Integer => 123,
28
30
  'foobar' => { 'bar' => 'bar' },
29
- 'aa-zz' => [{ 'bar' => :bar, 'a-z' => 'a-z' }]
31
+ 'aa-zz' => [{ 'bar' => :bar, 'a-z' => 'a-z' }]
30
32
  )
31
33
  end
32
34
  end
33
35
 
34
36
  describe '#identity' do
35
- subject { DeepHashTransformer.new(hash).identity }
37
+ subject { super().identity }
36
38
 
37
39
  it do
38
- is_expected.to eq(
40
+ expect(subject).to eq( # rubocop:disable RSpec/NamedSubject
39
41
  Integer => 123,
40
42
  :foobar => { bar: 'bar' },
41
43
  'aa_zz' => [{ 'bar' => :bar, 'a-z' => 'a-z' }]
@@ -44,37 +46,37 @@ RSpec.describe DeepHashTransformer do
44
46
  end
45
47
 
46
48
  describe '#stringify' do
47
- subject { DeepHashTransformer.new(hash).stringify }
49
+ subject { super().stringify }
48
50
 
49
51
  it do
50
- is_expected.to eq(
52
+ expect(subject).to eq( # rubocop:disable RSpec/NamedSubject
51
53
  Integer => 123,
52
54
  'foobar' => { 'bar' => 'bar' },
53
- 'aa_zz' => [{ 'bar' => :bar, 'a-z' => 'a-z' }]
55
+ 'aa_zz' => [{ 'bar' => :bar, 'a-z' => 'a-z' }]
54
56
  )
55
57
  end
56
58
  end
57
59
 
58
60
  describe '#symbolize' do
59
- subject { DeepHashTransformer.new(hash).symbolize }
61
+ subject { super().symbolize }
60
62
 
61
63
  it do
62
- is_expected.to eq(
64
+ expect(subject).to eq( # rubocop:disable RSpec/NamedSubject
63
65
  Integer => 123,
64
66
  :foobar => { bar: 'bar' },
65
- :aa_zz => [{ bar: :bar, 'a-z': 'a-z' }]
67
+ :aa_zz => [{ bar: :bar, 'a-z': 'a-z' }]
66
68
  )
67
69
  end
68
70
  end
69
71
 
70
72
  describe '#underscore' do
71
- subject { DeepHashTransformer.new(hash).underscore }
73
+ subject { super().underscore }
72
74
 
73
75
  it do
74
- is_expected.to eq(
76
+ expect(subject).to eq( # rubocop:disable RSpec/NamedSubject
75
77
  Integer => 123,
76
78
  'foobar' => { 'bar' => 'bar' },
77
- 'aa_zz' => [{ 'bar' => :bar, 'a_z' => 'a-z' }]
79
+ 'aa_zz' => [{ 'bar' => :bar, 'a_z' => 'a-z' }]
78
80
  )
79
81
  end
80
82
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'coveralls'
3
5
  require 'deep_hash_transformer'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deep_hash_transformer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Spickermann
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-26 00:00:00.000000000 Z
11
+ date: 2020-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coveralls
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-performance
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  description: " DeepHashTransformer helps to transform deeply nested hash structures\n"
70
98
  email:
71
99
  - spickermann@gmail.com
@@ -82,7 +110,7 @@ homepage: https://github.com/spickermann/deep_hash_transformer
82
110
  licenses:
83
111
  - MIT
84
112
  metadata: {}
85
- post_install_message:
113
+ post_install_message:
86
114
  rdoc_options: []
87
115
  require_paths:
88
116
  - lib
@@ -90,16 +118,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
118
  requirements:
91
119
  - - ">="
92
120
  - !ruby/object:Gem::Version
93
- version: 2.2.0
121
+ version: 2.5.0
94
122
  required_rubygems_version: !ruby/object:Gem::Requirement
95
123
  requirements:
96
124
  - - ">="
97
125
  - !ruby/object:Gem::Version
98
126
  version: '0'
99
127
  requirements: []
100
- rubyforge_project:
101
- rubygems_version: 2.7.3
102
- signing_key:
128
+ rubygems_version: 3.2.3
129
+ signing_key:
103
130
  specification_version: 4
104
131
  summary: Transforms deeply nested hash structure
105
132
  test_files: []