Class: MongoTestServer::TmpStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/mongo_test_server/tmp_storage.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ TmpStorage

Returns a new instance of TmpStorage.



10
11
12
13
# File 'lib/mongo_test_server/tmp_storage.rb', line 10

def initialize(name)
  @name = "#{name}-mongo-tmp"
  @tmp_dir = "#{Dir.tmpdir}/#{@name}"
end

Instance Method Details

#createObject



15
16
17
18
# File 'lib/mongo_test_server/tmp_storage.rb', line 15

def create
  FileUtils.mkdir_p @tmp_dir
  path
end

#deleteObject



24
25
26
# File 'lib/mongo_test_server/tmp_storage.rb', line 24

def delete
  FileUtils.rm_rf @tmp_dir
end

#pathObject



20
21
22
# File 'lib/mongo_test_server/tmp_storage.rb', line 20

def path
  @tmp_dir
end