From 8b66b47642db0a078454af239a9f6835fa600d4d Mon Sep 17 00:00:00 2001 From: Colin Kelley Date: Sun, 9 Jan 2022 15:29:40 -0800 Subject: [PATCH] issue #548: remove superstitious ||= {} since that is implied in the @tree hash --- lib/listen/record.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/listen/record.rb b/lib/listen/record.rb index 28305edc..2218149f 100644 --- a/lib/listen/record.rb +++ b/lib/listen/record.rb @@ -19,7 +19,7 @@ def initialize(directory, silencer) def add_dir(rel_path) if !empty_dirname?(rel_path.to_s) - @tree[rel_path] ||= {} + @tree[rel_path.to_s] end end @@ -36,10 +36,8 @@ def unset_path(rel_path) def file_data(rel_path) dirname, basename = Pathname(rel_path).split.map(&:to_s) if empty_dirname?(dirname) - @tree[basename] ||= {} @tree[basename].dup else - @tree[dirname] ||= {} @tree[dirname][basename] ||= {} @tree[dirname][basename].dup end @@ -84,9 +82,8 @@ def reset_tree def _fast_update_file(dirname, basename, data) if empty_dirname?(dirname.to_s) - @tree[basename] = (@tree[basename] || {}).merge(data) + @tree[basename] = @tree[basename].merge(data) else - @tree[dirname] ||= {} @tree[dirname][basename] = (@tree[dirname][basename] || {}).merge(data) end end