class Gluer::FilePool
Attributes
files[RW]
Public Class Methods
new()
click to toggle source
# File lib/gluer/file_pool.rb, line 7 def initialize clear end
Public Instance Methods
clear()
click to toggle source
# File lib/gluer/file_pool.rb, line 15 def clear @files = Hash.new end
get(path)
click to toggle source
# File lib/gluer/file_pool.rb, line 11 def get(path) files[path] end
update()
click to toggle source
# File lib/gluer/file_pool.rb, line 19 def update updated_file_paths = Set.new(collect) (current_file_paths - updated_file_paths).each do |old_path| files.delete(old_path).unload end updated_file_paths.each do |path| (files[path] ||= File.new(path)).reload end end
Private Instance Methods
collect()
click to toggle source
# File lib/gluer/file_pool.rb, line 32 def collect base_path = Gluer.config.base_path signature = Gluer.config.magic_signature Gluer.config.file_filter.call(base_path, signature) end
current_file_paths()
click to toggle source
# File lib/gluer/file_pool.rb, line 38 def current_file_paths Set.new(files.keys) end