Class: ActiveAdmin::AsyncExporter::Services::DiskService

Inherits:
Object
  • Object
show all
Defined in:
lib/active_admin/async_exporter/services/disk_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ DiskService

Returns a new instance of DiskService.



9
10
11
12
# File 'lib/active_admin/async_exporter/services/disk_service.rb', line 9

def initialize(file)
  @file = file
  @folder = ActiveAdmin::AsyncExporter.config.disk_folder_path
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



7
8
9
# File 'lib/active_admin/async_exporter/services/disk_service.rb', line 7

def file
  @file
end

#folderObject

Returns the value of attribute folder.



7
8
9
# File 'lib/active_admin/async_exporter/services/disk_service.rb', line 7

def folder
  @folder
end

Instance Method Details

#deleteObject



24
25
26
# File 'lib/active_admin/async_exporter/services/disk_service.rb', line 24

def delete
  File.delete(filename)
end

#storeObject



14
15
16
17
18
# File 'lib/active_admin/async_exporter/services/disk_service.rb', line 14

def store
  make_dir
  @object = IO.copy_stream(file[:path], filename)
  self
end

#urlObject



20
21
22
# File 'lib/active_admin/async_exporter/services/disk_service.rb', line 20

def url
  filename
end