lib/ramdo/ramdisk/linux_wrapper.rb in ramdo-0.1.5 vs lib/ramdo/ramdisk/linux_wrapper.rb in ramdo-0.2.1

- old
+ new

@@ -10,12 +10,12 @@ end def list disks = [] Dir.glob(@shm_path + '/*').each do |dir| - if dir =~ Instance::NAME_PATTERN - disks << Instance.new(path: dir, device: @shm_path, size: Filesize.from("1 GB")) + if dir.split(File::SEPARATOR).last =~ Instance::NAME_PATTERN + disks << Instance.new(self, path: dir, device: @shm_path, size: Filesize.from("1 GB")) end end disks end @@ -32,12 +32,10 @@ list().select { |disk| disk.path == path }.first end def destroy(instance) return false unless File.exist? instance.path - - Dir.glob(instance.path + "/*").each { |file| File.delete(file) if File.file? file } - Dir.rmdir(instance.path) + FileUtils.rm_r instance.path, :force => true end private def enough_ram?(size) size = Filesize.from(size) if size.is_a? String