rudash 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rudash/update.rb +18 -0
- data/lib/rudash.rb +2 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c42a0d5f572e904adb836f7e67bf6c91b1a54c675a07382cad99063b25d0983
|
4
|
+
data.tar.gz: 2132cab1f1aa7cbbf16b93bc22b3285a4d4cd10afaa2b09444e8a69b5025e3d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b764411b08782911a3efd6c6db5473cd76ed4f9a2a535cd6e159981915049014257441b6290525a7d4a46273b5571ff3afb051b474af837c584af1a862794adc
|
7
|
+
data.tar.gz: 3a80b8b21589f6a09b9d40c0d6302be461734d84ea17b64a5fff85269554a4ca1829ec558d05f607ea0edf9e4f6188939be8be2619fe961b3430c11cab7e0a3b
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative 'identity.rb'
|
2
|
+
require_relative 'get.rb'
|
3
|
+
require_relative 'set.rb'
|
4
|
+
require_relative 'head.rb'
|
5
|
+
|
6
|
+
module Update
|
7
|
+
extend Identity
|
8
|
+
extend Get
|
9
|
+
extend Set
|
10
|
+
extend Head
|
11
|
+
|
12
|
+
def update(object, path, *rest_args)
|
13
|
+
updater = self.head(rest_args) || self.method(:identity)
|
14
|
+
current_value = self.get(object, path)
|
15
|
+
self.set(object, path, updater.(current_value))
|
16
|
+
object
|
17
|
+
end
|
18
|
+
end
|
data/lib/rudash.rb
CHANGED
@@ -40,6 +40,7 @@ require_relative './rudash/join.rb'
|
|
40
40
|
require_relative './rudash/initial.rb'
|
41
41
|
require_relative './rudash/set.rb'
|
42
42
|
require_relative './rudash/pick.rb'
|
43
|
+
require_relative './rudash/update.rb'
|
43
44
|
|
44
45
|
class R_
|
45
46
|
extend Map
|
@@ -84,4 +85,5 @@ class R_
|
|
84
85
|
extend Initial
|
85
86
|
extend Set
|
86
87
|
extend Pick
|
88
|
+
extend Update
|
87
89
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rudash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Islam Attrash
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- lib/rudash/some.rb
|
59
59
|
- lib/rudash/tail.rb
|
60
60
|
- lib/rudash/uniq.rb
|
61
|
+
- lib/rudash/update.rb
|
61
62
|
- lib/rudash/without.rb
|
62
63
|
- lib/utils/index.rb
|
63
64
|
- lib/utils/nested_path_creator.rb
|