lib/ramdo/ramdisk/darwin_wrapper.rb in ramdo-0.1.1 vs lib/ramdo/ramdisk/darwin_wrapper.rb in ramdo-0.1.2
- old
+ new
@@ -40,10 +40,17 @@
# Receive all disk and select just created one
list().select { |disk| disk.device == device }.first
end
+ def destroy(instance)
+ return false unless File.exist? instance.device
+
+ line = Cocaine::CommandLine.new("hdiutil", "detach :device")
+ line.run(device: instance.device)
+ end
+
private
def enough_ram?(size)
size = Filesize.from(size) if size.is_a? String
pages_free = 0
page_size = 0
@@ -59,6 +66,6 @@
Filesize.new(pages_free * page_size) > size
end
end
end
-end
\ No newline at end of file
+end