Removing "." and ".." directories while walking the FS the right way (#entries -> #children).
parent
179d5e6e17
commit
19d878e21c
|
@ -1,5 +1,5 @@
|
||||||
name: dodb
|
name: dodb
|
||||||
version: 0.5.0
|
version: 0.5.1
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
- Luka Vandervelden <lukc@upyum.com>
|
- Luka Vandervelden <lukc@upyum.com>
|
||||||
|
|
|
@ -438,7 +438,7 @@ abstract class DODB::Storage(V)
|
||||||
# Lists all the keys in the database.
|
# Lists all the keys in the database.
|
||||||
private def each_key(reversed = false)
|
private def each_key(reversed = false)
|
||||||
# Removes the first two "." and ".." directories.
|
# Removes the first two "." and ".." directories.
|
||||||
keys = Dir.entries(data_path).[2..].map(&.to_i).sort
|
keys = Dir.children(data_path).map(&.to_i).sort
|
||||||
(reversed ? keys.reverse : keys).each do |key|
|
(reversed ? keys.reverse : keys).each do |key|
|
||||||
yield key
|
yield key
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue