Sha256: 1dd155fa6385f677a613146d84a0ce45fb8ae72434ca7f00dfd52b1a5e8df2a9
Contents?: true
Size: 853 Bytes
Versions: 12
Compression:
Stored size: 853 Bytes
Contents
module Listen class Record include Celluloid attr_accessor :paths, :listener def initialize(listener) @listener = listener @paths = _init_paths end def set_path(path, data) @paths[::File.dirname(path)][::File.basename(path)] = file_data(path).merge(data) end def unset_path(path) @paths[::File.dirname(path)].delete(::File.basename(path)) end def file_data(path) @paths[::File.dirname(path)][::File.basename(path)] || {} end def dir_entries(path) @paths[path.to_s] end def build @paths = _init_paths listener.directories.each do |path| Actor[:listen_change_pool].change(path, type: 'Dir', recursive: true, silence: true) end end private def _init_paths Hash.new { |h, k| h[k] = Hash.new } end end end
Version data entries
12 entries across 12 versions & 1 rubygems