active_cabinet 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_cabinet/metaclass.rb +8 -0
- data/lib/active_cabinet/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: 8dd6fedc3ca5771467baee667ae128cf77f2042394e28169057c3707205391fc
|
4
|
+
data.tar.gz: c89be55b4d4d6d4bbebe6a6044fd24145027454716c4118da2b8c57e75acca9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cdcf93a07fc0ff445812239c21f5602eb10ce014a242359351bc1d5bb5109964ebaf6a9975891ea090a5efa639c516d14c078ea24c44920664d444308be1f2b
|
7
|
+
data.tar.gz: 2bc8d3fcac688ea0b0625ea28787b3f7d39222e943ae5f0aa1e4887e40fa8899b079fe743536280488313fcdf5c19d961c05ebb8bd6bf0d163ae643174cebc58
|
@@ -152,6 +152,14 @@ class ActiveCabinet
|
|
152
152
|
!!cabinet.delete(id)
|
153
153
|
end
|
154
154
|
|
155
|
+
# Deletes a record for which the block returns true.
|
156
|
+
#
|
157
|
+
# @example Delete records using a block
|
158
|
+
# Song.delete_if { |record| record[:artist] == "Iron Maiden" }
|
159
|
+
def delete_if
|
160
|
+
cabinet.delete_if { |key, _value| yield self[key] }
|
161
|
+
end
|
162
|
+
|
155
163
|
# Deletes all records.
|
156
164
|
def drop
|
157
165
|
cabinet.clear
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_cabinet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hash_cabinet
|