Block captures fixed.
This commit is contained in:
parent
eac9a77fa6
commit
fbdb451f0e
@ -66,7 +66,7 @@ class DODB::Partition(V) < DODB::Indexer(V)
|
|||||||
delete partition, do true end
|
delete partition, do true end
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete(partition, &matcher)
|
def delete(partition, &matcher : Proc(V, Bool))
|
||||||
partition_directory = indexing_directory partition
|
partition_directory = indexing_directory partition
|
||||||
|
|
||||||
return unless Dir.exists? partition_directory
|
return unless Dir.exists? partition_directory
|
||||||
@ -155,7 +155,7 @@ class DODB::CachedPartition(V) < DODB::Partition(V)
|
|||||||
get_with_indexes(partition).map &.[0]
|
get_with_indexes(partition).map &.[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete(partition, &matcher)
|
def delete(partition, &matcher : Proc(V, Bool))
|
||||||
# Use `get_with_indexes` to retrieve data on-disk, if necessary.
|
# Use `get_with_indexes` to retrieve data on-disk, if necessary.
|
||||||
new_partition = get_with_indexes(partition).map(&.[1]).select do |key|
|
new_partition = get_with_indexes(partition).map(&.[1]).select do |key|
|
||||||
item = @storage[key]
|
item = @storage[key]
|
||||||
@ -164,10 +164,13 @@ class DODB::CachedPartition(V) < DODB::Partition(V)
|
|||||||
|
|
||||||
@data[partition] = new_partition
|
@data[partition] = new_partition
|
||||||
|
|
||||||
super(partition, matcher)
|
super(partition, &matcher)
|
||||||
end
|
end
|
||||||
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)
|
class DODB::RAMOnlyPartition(V) < DODB::CachedPartition(V)
|
||||||
def index(key, value)
|
def index(key, value)
|
||||||
partition = key_proc.call value
|
partition = key_proc.call value
|
||||||
@ -202,7 +205,7 @@ class DODB::RAMOnlyPartition(V) < DODB::CachedPartition(V)
|
|||||||
r_value
|
r_value
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete(partition, &matcher)
|
def delete(partition, &matcher : Proc(V, Bool))
|
||||||
if keys = @data[partition]?
|
if keys = @data[partition]?
|
||||||
new_partition = keys.select do |key|
|
new_partition = keys.select do |key|
|
||||||
item = @storage[key]
|
item = @storage[key]
|
||||||
|
@ -181,11 +181,13 @@ class DODB::CachedTags(V) < DODB::Tags(V)
|
|||||||
|
|
||||||
@data[tag] = new_tag
|
@data[tag] = new_tag
|
||||||
|
|
||||||
super(tag, matcher)
|
super(tag, &matcher)
|
||||||
end
|
end
|
||||||
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)
|
class DODB::RAMOnlyTags(V) < DODB::CachedTags(V)
|
||||||
def index(key, value)
|
def index(key, value)
|
||||||
indices = key_proc.call value
|
indices = key_proc.call value
|
||||||
|
Loading…
Reference in New Issue
Block a user