Partition#get(unknown_partition) returns []

master
Luka Vandervelden 2020-02-11 19:47:13 +01:00
parent 74aff338ff
commit f8e4e6c343
2 changed files with 5 additions and 0 deletions

View File

@ -307,6 +307,8 @@ describe "DODB::DataBase" do
a && b
}.should be_true
end
db_ships_by_class.get("does-not-exist").should eq [] of Ship
end
it "removes select elements from partitions" do

View File

@ -43,6 +43,9 @@ class DODB::Partition(V) < DODB::Indexer(V)
r_value = Array(V).new
partition_directory = indexing_directory partition
return r_value unless Dir.exists? partition_directory
Dir.each_child partition_directory do |child|
r_value << V.from_json ::File.read "#{partition_directory}/#{child}"
end