class XmlConv::Util::PollingMission
Attributes
directory[RW]
glob_pattern[RW]
Public Instance Methods
file_paths()
click to toggle source
# File lib/xmlconv/util/polling_manager.rb, line 42 def file_paths path = File.expand_path(@glob_pattern || '*', @directory) Dir.glob(path).collect { |entry| File.expand_path(entry, @directory) }.compact end
poll() { |transaction| ... }
click to toggle source
# File lib/xmlconv/util/polling_manager.rb, line 48 def poll @directory = File.expand_path(@directory, CONFIG.project_root) file_paths.each { |path| begin filtered_transaction(File.read(path), 'file:' << path) { |transaction| yield transaction } rescue Exception => e puts e puts e.backtrace ensure FileUtils.mkdir_p(@backup_dir) FileUtils.mv(path, @backup_dir) end } end