Class: Insup::Uploader::DummyUploader

Inherits:
Insup::Uploader show all
Defined in:
lib/insup/uploader/dummy_uploader.rb

Constant Summary

Constants inherited from Insup::Uploader

BATCH_UPLOADED_FILES, BATCH_UPLOADING_FILES, CREATED_FILE, CREATING_FILE, DELETED_FILE, DELETING_FILE, ERROR, MODIFIED_FILE, MODIFYING_FILE

Instance Method Summary collapse

Methods inherited from Insup::Uploader

#delete_file, find_uploader, #initialize, #process_file, uploader

Constructor Details

This class inherits a constructor from Insup::Uploader

Instance Method Details

#batch_upload(files) ⇒ Object



29
30
31
32
33
34
# File 'lib/insup/uploader/dummy_uploader.rb', line 29

def batch_upload(files)
  changed
  notify_observers(BATCH_UPLOADING_FILE, file)
  changed
  notify_observers(BATCH_UPLOADED_FILE, file)
end

#remove_file(file) ⇒ Object



22
23
24
25
26
27
# File 'lib/insup/uploader/dummy_uploader.rb', line 22

def remove_file file
  changed
  notify_observers(DELETING_FILE, file)
  changed
  notify_observers(DELETED_FILE, file)
end

#upload_file(file) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/insup/uploader/dummy_uploader.rb', line 7

def upload_file(file)
  case file.state
  when Insup::TrackedFile::NEW
    changed
    notify_observers(CREATING_FILE, file)
    changed
    notify_observers(CREATED_FILE, file)
  when Insup::TrackedFile::MODIFIED, Insup::TrackedFile::UNSURE
    changed
    notify_observers(MODIFYING_FILE, file)
    changed
    notify_observers(MODIFIED_FILE, file)
  end
end