isomorfeus-transport 22.10.0.rc2 → 23.1.0.rc1

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: a357edde3dff97063ed07321dd218a6d04cc651305a2f8ae9699113b0bc5e6eb
4
- data.tar.gz: 8b91a14f365633de12b961036f136ae46f0287ebebe194f0f86cfa4843d039f7
3
+ metadata.gz: 36a45530ae7393bb5f497e0edd322a62d2fe44fabb503d5ce89163abc919390b
4
+ data.tar.gz: ecd1a2c61000df64b147585eadc01c24079092bda511dce3da9410bba70bc690
5
5
  SHA512:
6
- metadata.gz: c49695c1dba8cf9f13fb9c15ecc79d85f3062fc6df6ceef602211bb986f81feffd3ce1b453416bfd3d8d22cd0f106553c3b6039aa4c44d5280cc58ae481afdd2
7
- data.tar.gz: 1e3e4e65296a5ed690f0daa58b0661a912e9d9c3d39acd6f78d33d79d6ddc5ae6ea209ba07c9e858828ddba683b25016dbaeec8409f25399dcb4a14ae0d0d91f
6
+ metadata.gz: 51f49b11201169976d1c47fadcc50435ca8ba1e7a8e2e66ec719e5566e919fdfed47b6c69ce6d7da636d729ba251e89700f4b83568c4a8f46f713066a3a8d325
7
+ data.tar.gz: b03b30763c33d57d1d566b464d5ce73051009e3f36ae0260e55e9c26fc6d0b5475b4c798cf52736687edb4750021500b2c9f26ba2744e7a863dd25feefcd5dd9
@@ -0,0 +1,77 @@
1
+ class Hash
2
+ def deep_freeze
3
+ each_value do |value|
4
+ value.deep_freeze if value.is_a?(Hash)
5
+ end
6
+ self
7
+ end
8
+
9
+ if RUBY_ENGINE == 'opal'
10
+ def self.recursive_new(obj)
11
+ %x{
12
+ var key, val;
13
+ for (var key in obj) {
14
+ val = obj[key];
15
+ if (typeof val === "object" && !val.$$is_array && !val.$$is_hash && !Array.isArray(val)) {
16
+ obj[key] = #{Hash.recursive_new(`val`)};
17
+ }
18
+ }
19
+ return Opal.hash(obj);
20
+ }
21
+ end
22
+ end
23
+
24
+ # originally taken from: https://github.com/rails/rails/blob/main/activesupport/lib/active_support/core_ext/object/deep_dup.rb
25
+ # Returns a deep copy of hash.
26
+ #
27
+ # hash = { a: { b: 'b' } }
28
+ # dup = hash.deep_dup
29
+ # dup[:a][:c] = 'c'
30
+ #
31
+ # hash[:a][:c] # => nil
32
+ # dup[:a][:c] # => "c"
33
+ def deep_dup
34
+ hash = dup
35
+ each_pair do |key, value|
36
+ if ::String === key || ::Symbol === key
37
+ hash[key] = value.deep_dup
38
+ else
39
+ hash.delete(key)
40
+ hash[key.deep_dup] = value.deep_dup
41
+ end
42
+ end
43
+ hash
44
+ end
45
+
46
+ # originally taken from: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/hash/deep_merge.rb
47
+ # Returns a new hash with +self+ and +other_hash+ merged recursively.
48
+ #
49
+ # h1 = { a: true, b: { c: [1, 2, 3] } }
50
+ # h2 = { a: false, b: { x: [3, 4, 5] } }
51
+ #
52
+ # h1.deep_merge(h2) # => { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } }
53
+ #
54
+ # Like with Hash#merge in the standard library, a block can be provided
55
+ # to merge values:
56
+ #
57
+ # h1 = { a: 100, b: 200, c: { c1: 100 } }
58
+ # h2 = { b: 250, c: { c1: 200 } }
59
+ # h1.deep_merge(h2) { |key, this_val, other_val| this_val + other_val }
60
+ # # => { a: 100, b: 450, c: { c1: 300 } }
61
+ def deep_merge(other_hash, &block)
62
+ dup.deep_merge!(other_hash, &block)
63
+ end
64
+
65
+ # Same as +deep_merge+, but modifies +self+.
66
+ def deep_merge!(other_hash, &block)
67
+ merge!(other_hash) do |key, this_val, other_val|
68
+ if this_val.is_a?(Hash) && other_val.is_a?(Hash)
69
+ this_val.deep_merge(other_val, &block)
70
+ elsif block_given?
71
+ block.call(key, this_val, other_val)
72
+ else
73
+ other_val
74
+ end
75
+ end
76
+ end
77
+ end
@@ -28,26 +28,3 @@ class Array
28
28
  map(&:deep_dup)
29
29
  end
30
30
  end
31
-
32
- class Hash
33
- # Returns a deep copy of hash.
34
- #
35
- # hash = { a: { b: 'b' } }
36
- # dup = hash.deep_dup
37
- # dup[:a][:c] = 'c'
38
- #
39
- # hash[:a][:c] # => nil
40
- # dup[:a][:c] # => "c"
41
- def deep_dup
42
- hash = dup
43
- each_pair do |key, value|
44
- if ::String === key || ::Symbol === key
45
- hash[key] = value.deep_dup
46
- else
47
- hash.delete(key)
48
- hash[key.deep_dup] = value.deep_dup
49
- end
50
- end
51
- hash
52
- end
53
- end
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Transport
3
- VERSION = '22.10.0.rc2'
3
+ VERSION = '23.1.0.rc1'
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  require 'isomorfeus/core_ext/kernel'
2
2
  require 'isomorfeus/core_ext/object/duplicable'
3
3
  require 'isomorfeus/core_ext/object/deep_dup'
4
- require 'isomorfeus/core_ext/hash/deep_merge'
4
+ require 'isomorfeus/core_ext/hash_ext'
5
5
  require 'active_support/core_ext/string'
6
6
 
7
7
  require 'zeitwerk'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 22.10.0.rc2
4
+ version: 23.1.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-07 00:00:00.000000000 Z
11
+ date: 2023-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 7.0.3
19
+ version: 7.0.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 7.0.3
26
+ version: 7.0.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bcrypt
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,84 +72,84 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.8.1
75
+ version: 0.8.2
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.8.1
82
+ version: 0.8.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: oj
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 3.13.21
89
+ version: 3.13.23
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 3.13.21
96
+ version: 3.13.23
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: opal
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 1.5.1
103
+ version: 1.7.0.rc1
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 1.5.1
110
+ version: 1.7.0.rc1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: opal-zeitwerk
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.4.2
117
+ version: 0.4.4
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.4.2
124
+ version: 0.4.4
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rack
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 3.0.0
131
+ version: 3.0.3
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 3.0.0
138
+ version: 3.0.3
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rackup
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.2.2
145
+ version: 0.2.3
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.2.2
152
+ version: 0.2.3
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: zeitwerk
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -170,28 +170,28 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 2.1.1
173
+ version: 3.0.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 2.1.1
180
+ version: 3.0.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: isomorfeus
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - '='
186
186
  - !ruby/object:Gem::Version
187
- version: 22.10.0.rc2
187
+ version: 23.1.0.rc1
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - '='
193
193
  - !ruby/object:Gem::Version
194
- version: 22.10.0.rc2
194
+ version: 23.1.0.rc1
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rake
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: 3.11.0
215
+ version: 3.12.0
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: 3.11.0
222
+ version: 3.12.0
223
223
  description: Channels, authetication and various transport options for Isomorfeus.
224
224
  email: jan@kursator.de
225
225
  executables: []
@@ -229,7 +229,7 @@ files:
229
229
  - LICENSE
230
230
  - README.md
231
231
  - lib/isomorfeus-transport.rb
232
- - lib/isomorfeus/core_ext/hash/deep_merge.rb
232
+ - lib/isomorfeus/core_ext/hash_ext.rb
233
233
  - lib/isomorfeus/core_ext/kernel.rb
234
234
  - lib/isomorfeus/core_ext/object/deep_dup.rb
235
235
  - lib/isomorfeus/core_ext/object/duplicable.rb
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  - !ruby/object:Gem::Version
269
269
  version: 1.3.1
270
270
  requirements: []
271
- rubygems_version: 3.4.0.dev
271
+ rubygems_version: 3.4.1
272
272
  signing_key:
273
273
  specification_version: 4
274
274
  summary: Channels, authetication and various transport options for Isomorfeus.
@@ -1,34 +0,0 @@
1
- # originally taken from: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/hash/deep_merge.rb
2
-
3
- class Hash
4
- # Returns a new hash with +self+ and +other_hash+ merged recursively.
5
- #
6
- # h1 = { a: true, b: { c: [1, 2, 3] } }
7
- # h2 = { a: false, b: { x: [3, 4, 5] } }
8
- #
9
- # h1.deep_merge(h2) # => { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } }
10
- #
11
- # Like with Hash#merge in the standard library, a block can be provided
12
- # to merge values:
13
- #
14
- # h1 = { a: 100, b: 200, c: { c1: 100 } }
15
- # h2 = { b: 250, c: { c1: 200 } }
16
- # h1.deep_merge(h2) { |key, this_val, other_val| this_val + other_val }
17
- # # => { a: 100, b: 450, c: { c1: 300 } }
18
- def deep_merge(other_hash, &block)
19
- dup.deep_merge!(other_hash, &block)
20
- end
21
-
22
- # Same as +deep_merge+, but modifies +self+.
23
- def deep_merge!(other_hash, &block)
24
- merge!(other_hash) do |key, this_val, other_val|
25
- if this_val.is_a?(Hash) && other_val.is_a?(Hash)
26
- this_val.deep_merge(other_val, &block)
27
- elsif block_given?
28
- block.call(key, this_val, other_val)
29
- else
30
- other_val
31
- end
32
- end
33
- end
34
- end