Class: RemoteFiles::ResqueJob

Inherits:
Object
  • Object
show all
Defined in:
lib/remote_files/resque_job.rb

Class Method Summary collapse

Class Method Details

.perform(options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/remote_files/resque_job.rb', line 6

def self.perform(options)
  identifier = options.delete(:identifier) || options.delete("identifier")
  action     = options.delete(:_action)    || options.delete("_action")

  file = RemoteFiles::File.new(identifier, options)

  case action.to_sym
  when :synchronize
    file.synchronize!
  when :delete
    begin
      file.delete_now!
    rescue NotFoundError
    end
  else
    raise "unknown action #{action.inspect}"
  end
end