FS::Hash#to_h
This commit is contained in:
parent
027c7598eb
commit
80fd26fad2
12
src/fs.cr
12
src/fs.cr
@ -116,6 +116,18 @@ class FS::Hash(K, V)
|
|||||||
end
|
end
|
||||||
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)
|
private def file_path(key : K)
|
||||||
"#{@directory_name}/#{key.to_s}.json"
|
"#{@directory_name}/#{key.to_s}.json"
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user