lib/ramdo/ramdisk/instance.rb in ramdo-0.1.1 vs lib/ramdo/ramdisk/instance.rb in ramdo-0.1.2

- old
+ new

@@ -1,8 +1,10 @@ module Ramdo module Ramdisk class Instance + NAME_PATTERN = /ramdo_[A-Za-z0-9_-]+$/ + def self.generate_name "ramdo_#{SecureRandom.uuid}" end attr_accessor :device, :path, :size @@ -12,13 +14,11 @@ @path = info[:path] @size = info[:size] end def destroy! - return false unless File.exist? @device - - line = Cocaine::CommandLine.new("hdiutil", "detach :device") - line.run(device: @device) + wrapper = Ramdisk::Factory.get + wrapper.destroy self end end end -end \ No newline at end of file +end