Class: Insup::Console::UploadObserver

Inherits:
Object
  • Object
show all
Defined in:
lib/insup/console/upload_observer.rb

Instance Method Summary collapse

Instance Method Details

#update(event, *args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/insup/console/upload_observer.rb', line 5

def update(event, *args)
  file = args[0]

  case event
  when Insup::Uploader::CREATING_FILE
    puts "Creating file #{file.path}...".green
  when Insup::Uploader::MODIFYING_FILE
    puts "Uploading file #{file.path}...".yellow
  when Insup::Uploader::DELETING_FILE
    puts "Deleting file #{file.path}...".red
  when Insup::Uploader::ERROR
    message = args[1]
    puts "Error in #{file.path}: #{message}".red
  end
end