FS::Hash#to_h

master
Luka Vandervelden 2019-01-02 01:36:17 +09:00
parent 027c7598eb
commit 80fd26fad2
1 changed files with 12 additions and 0 deletions

View File

@ -116,6 +116,18 @@ class FS::Hash(K, V)
end
end
##
# CAUTION: Very slow. Try not to use.
def to_h
hash = ::Hash(K, V).new
each do |key, value|
hash[key] = value
end
hash
end
private def file_path(key : K)
"#{@directory_name}/#{key.to_s}.json"
end