Block captures fixed.

Philippe PITTOLI 2024-05-08 22:43:15 +02:00
parent eac9a77fa6
commit fbdb451f0e
2 changed files with 11 additions and 6 deletions

View File

@ -66,7 +66,7 @@ class DODB::Partition(V) < DODB::Indexer(V)
delete partition, do true end
end
def delete(partition, &matcher)
def delete(partition, &matcher : Proc(V, Bool))
partition_directory = indexing_directory partition
return unless Dir.exists? partition_directory
@ -155,7 +155,7 @@ class DODB::CachedPartition(V) < DODB::Partition(V)
get_with_indexes(partition).map &.[0]
end
def delete(partition, &matcher)
def delete(partition, &matcher : Proc(V, Bool))
# Use `get_with_indexes` to retrieve data on-disk, if necessary.
new_partition = get_with_indexes(partition).map(&.[1]).select do |key|
item = @storage[key]
@ -164,10 +164,13 @@ class DODB::CachedPartition(V) < DODB::Partition(V)
@data[partition] = new_partition
super(partition, matcher)
super(partition, &matcher)
end
end
# `DODB::RAMOnlyPartition` enables the flexibility of partitions without a file-system representation.
# Absolute efficiency, exactly as easy to use as the other partition implementations.
class DODB::RAMOnlyPartition(V) < DODB::CachedPartition(V)
def index(key, value)
partition = key_proc.call value
@ -202,7 +205,7 @@ class DODB::RAMOnlyPartition(V) < DODB::CachedPartition(V)
r_value
end
def delete(partition, &matcher)
def delete(partition, &matcher : Proc(V, Bool))
if keys = @data[partition]?
new_partition = keys.select do |key|
item = @storage[key]

View File

@ -181,11 +181,13 @@ class DODB::CachedTags(V) < DODB::Tags(V)
@data[tag] = new_tag
super(tag, matcher)
super(tag, &matcher)
end
end
# TODO
# `DODB::RAMOnlyTags` enables the flexibility of tags without a file-system representation.
# Absolute efficiency, exactly as easy to use as the other tag implementations.
class DODB::RAMOnlyTags(V) < DODB::CachedTags(V)
def index(key, value)
indices = key_proc.call value