rudash 2.16.0 → 2.17.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/each_right.rb +0 -2
- data/lib/rudash/filter.rb +0 -4
- data/lib/rudash/flip.rb +0 -2
- data/lib/rudash/flow.rb +0 -2
- data/lib/rudash/flow_right.rb +0 -2
- data/lib/rudash/get.rb +0 -3
- data/lib/rudash/map.rb +0 -3
- data/lib/rudash/negate.rb +0 -2
- data/lib/rudash/reduce.rb +0 -3
- data/lib/rudash/reduce_right.rb +0 -2
- data/lib/rudash/reject.rb +0 -3
- data/lib/rudash/set.rb +0 -4
- data/lib/rudash/unset.rb +34 -0
- data/lib/rudash/update.rb +0 -3
- data/lib/rudash.rb +8 -0
- data/lib/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87006924b8306d1dcb903192cc048f98eaab46d221a8d3a4ec562983a2022dbc
|
4
|
+
data.tar.gz: 5c14cb17c6670b9341c79a07f1d81cc4624cc0a604de4bdde2d25e10050186e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7691a9391fd6763b9b64498776d7143fecc151f53b557b1cf8843814e4e867706d86e765d25c095b5d5252d5af51716eeeebb83cebc37d0aef37f1f0303910c9
|
7
|
+
data.tar.gz: 0cb3cd38629c407d63c312fb418e801d21512dd6ff32322828d2dff4ea09ad19b92a2f5607005c9768e9afe1e21fd196eb1bd0cff29a91bcf31513ec53e88167
|
data/lib/rudash/each_right.rb
CHANGED
data/lib/rudash/filter.rb
CHANGED
data/lib/rudash/flip.rb
CHANGED
data/lib/rudash/flow.rb
CHANGED
data/lib/rudash/flow_right.rb
CHANGED
data/lib/rudash/get.rb
CHANGED
data/lib/rudash/map.rb
CHANGED
data/lib/rudash/negate.rb
CHANGED
data/lib/rudash/reduce.rb
CHANGED
data/lib/rudash/reduce_right.rb
CHANGED
data/lib/rudash/reject.rb
CHANGED
data/lib/rudash/set.rb
CHANGED
data/lib/rudash/unset.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Rudash
|
2
|
+
module Unset
|
3
|
+
def unset(object, path)
|
4
|
+
return object if !object.is_a?(Hash) && !object.is_a?(Array)
|
5
|
+
|
6
|
+
*initial_path, last = Rudash::PathResolver.resolve(path)
|
7
|
+
|
8
|
+
last_parent = self.get(object, initial_path)
|
9
|
+
|
10
|
+
case last_parent
|
11
|
+
when Array
|
12
|
+
return false if !Rudash::Utils.match_number?(last)
|
13
|
+
|
14
|
+
last_key = last.to_i
|
15
|
+
if last_key > 0 && last_key < last_parent.length
|
16
|
+
last_parent.delete_at(last_key)
|
17
|
+
true
|
18
|
+
else
|
19
|
+
false
|
20
|
+
end
|
21
|
+
when Hash
|
22
|
+
last_key = Rudash::Utils.match_number?(last) ? last.to_i : last.to_sym
|
23
|
+
if last_parent.key?(last_key)
|
24
|
+
last_parent.delete(last_key)
|
25
|
+
true
|
26
|
+
else
|
27
|
+
false
|
28
|
+
end
|
29
|
+
else
|
30
|
+
false
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/rudash/update.rb
CHANGED
data/lib/rudash.rb
CHANGED
@@ -51,7 +51,14 @@ require_relative './rudash/drop_right.rb'
|
|
51
51
|
require_relative './rudash/chain.rb'
|
52
52
|
require_relative './rudash/flow.rb'
|
53
53
|
require_relative './rudash/flow_right.rb'
|
54
|
+
require_relative './rudash/unset.rb'
|
54
55
|
|
56
|
+
### Utils Requires
|
57
|
+
require_relative './utils/index.rb'
|
58
|
+
require_relative './utils/dynamic_args_count.rb'
|
59
|
+
require_relative './utils/path_resolver.rb'
|
60
|
+
require_relative './utils/subset_deep_match.rb'
|
61
|
+
require_relative './utils/nested_path_creator.rb'
|
55
62
|
require_relative './utils/chain_wrapper.rb'
|
56
63
|
|
57
64
|
# This is the exposed Gem class that contains all Rudash methods.
|
@@ -111,4 +118,5 @@ class R_
|
|
111
118
|
extend Rudash::Chain
|
112
119
|
extend Rudash::Flow
|
113
120
|
extend Rudash::FlowRight
|
121
|
+
extend Rudash::Unset
|
114
122
|
end
|
data/lib/version.rb
CHANGED
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.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Islam Attrash
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/rudash/take.rb
|
69
69
|
- lib/rudash/union.rb
|
70
70
|
- lib/rudash/uniq.rb
|
71
|
+
- lib/rudash/unset.rb
|
71
72
|
- lib/rudash/update.rb
|
72
73
|
- lib/rudash/without.rb
|
73
74
|
- lib/utils/chain_wrapper.rb
|
@@ -98,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
99
|
version: '0'
|
99
100
|
requirements: []
|
100
101
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.7.
|
102
|
+
rubygems_version: 2.7.7
|
102
103
|
signing_key:
|
103
104
|
specification_version: 4
|
104
105
|
summary: Rudash - Lodash for Ruby Apps
|