get_nn_partition returns an empty array if no key has been indexed.
parent
4858e5c4dc
commit
7a46fa3872
|
@ -80,6 +80,9 @@ class FS::Hash(K, V)
|
|||
r_value = Array(V).new
|
||||
|
||||
partition_directory = "#{dir_path_nn name}/#{key}"
|
||||
|
||||
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
|
||||
|
|
|
@ -55,3 +55,7 @@ s.to_h.size.times do
|
|||
pp! s.get_nn_partition("tags", "shiratsuyu").map &.title
|
||||
end
|
||||
|
||||
puts "Testing get_nn_partition on unknown entries."
|
||||
|
||||
pp! s.get_nn_partition("tags", "kaga").map &.title
|
||||
|
||||
|
|
Loading…
Reference in New Issue