lib/ramdo/ramdisk/instance.rb in ramdo-0.1.5 vs lib/ramdo/ramdisk/instance.rb in ramdo-0.2.1
- old
+ new
@@ -1,24 +1,24 @@
module Ramdo
module Ramdisk
class Instance
- NAME_PATTERN = /ramdo_[A-Za-z0-9_-]+$/
+ NAME_PATTERN = /^ramdo_disk_([a-z0-9]+)$/
def self.generate_name
- "ramdo_#{SecureRandom.uuid}"
+ "ramdo_disk_#{SecureRandom.hex(4)}"
end
attr_accessor :device, :path, :size
- def initialize(info = {})
+ def initialize(wrapper, info = {})
+ @wrapper = wrapper
@device = info[:device]
@path = info[:path]
@size = info[:size]
end
def destroy!
- wrapper = Ramdisk::Factory.get
- wrapper.destroy self
+ @wrapper.destroy self
end
end
end
end