Object
# File lib/listen/record.rb, line 15 def add_dir(dir, rel_path) return if [nil, '', '.'].include? rel_path @paths[dir.to_s][rel_path] ||= {} end
# File lib/listen/record.rb, line 59 def build start = Time.now.to_f @paths = _auto_hash # TODO: refactor this out (1 Record = 1 watched dir) listener.directories.each do |directory| _fast_build(directory.to_s) end Celluloid.logger.info "Record.build took #{Time.now.to_f - start} seconds" rescue Celluloid.logger.warn "build crashed: #{$!.inspect}" raise end
# File lib/listen/record.rb, line 43 def dir_entries(dir, rel_path) tree = if [nil, '', '.'].include? rel_path.to_s @paths[dir.to_s] else @paths[dir.to_s][rel_path.to_s] ||= _auto_hash @paths[dir.to_s][rel_path.to_s] end result = {} tree.each do |key, values| # only get data for file entries result[key] = values.key?(:mtime) ? values : {} end result end
# File lib/listen/record.rb, line 30 def file_data(dir, rel_path) root = @paths[dir.to_s] dirname, basename = Pathname(rel_path).split.map(&:to_s) if [nil, '', '.'].include? dirname root[basename] ||= {} root[basename].dup else root[dirname] ||= {} root[dirname][basename] ||= {} root[dirname][basename].dup end end
Generated with the Darkfish Rdoc Generator 2.