funcml-core 0.9.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/funcml-core/patch/hash.rb +27 -1
- data/lib/funcml-core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44b6c971761ae0490fe5e6e2fd1d01dc5f432de709db16390cf7689812da089f
|
4
|
+
data.tar.gz: fd6cfd70f933800d444e98b23df4ca1e5db587abb41174d2ac8ec504d9db89f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46ca29aa02bf9d4655eddf55f2ff03b6ad1d37c3972232da5c6278e0f0f30c08d61ab4ce4ece8320635fb05db8a41ce0c819d6de5c78b2cdc9abea09183dd37a
|
7
|
+
data.tar.gz: a1f23fb26b844e4c9944ae5bd0db4db5fd2031619c95daaab7526d6463d7202d02f3414fc81dd2f6e1f02e3ec35a0923c6a24414345a133ed5d3b79b72bc3757
|
@@ -32,6 +32,14 @@ class Hash
|
|
32
32
|
self
|
33
33
|
end
|
34
34
|
|
35
|
+
def _map(mutations)
|
36
|
+
self.fetch(:_map).then do |ctx|
|
37
|
+
ctx.fetch(:items, []).mutate(mutations).map do |item|
|
38
|
+
{ctx.fetch(:call).to_sym => item}.mutate(mutations)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
35
43
|
def _if(mutations)
|
36
44
|
_runcond = Proc.new do |cond, mutations|
|
37
45
|
case cond
|
@@ -173,13 +181,31 @@ class Hash
|
|
173
181
|
self.fetch(:_replace).then do |ctx|
|
174
182
|
content = ctx.fetch(:content)
|
175
183
|
ctx.fetch(:substitutions).each do |from, to|
|
176
|
-
content = content.gsub(from, to)
|
184
|
+
content = content.gsub(from.mutate(mutations), to.mutate(mutations))
|
177
185
|
end
|
178
186
|
|
179
187
|
content
|
180
188
|
end
|
181
189
|
end
|
182
190
|
|
191
|
+
def _upcase(mutations)
|
192
|
+
self.fetch(:_upcase).then do |ctx|
|
193
|
+
return ctx.mutate(mutations).upcase
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
def _downcase(mutations)
|
198
|
+
self.fetch(:_downcase).then do |ctx|
|
199
|
+
return ctx.mutate(mutations).downcase
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
def _capitalize(mutations)
|
204
|
+
self.fetch(:_capitalize).then do |ctx|
|
205
|
+
return ctx.mutate(mutations).capitalize
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
183
209
|
def dig_from_str(path, mutations)
|
184
210
|
path_array_sym = path.split('.').map do |sub|
|
185
211
|
sub.to_sym
|
data/lib/funcml-core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: funcml-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mimopotato
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A library that implements mutations on data-structures
|
14
14
|
email:
|