Module: Backgrounder::Handler::ClassMethods

Defined in:
lib/backgrounder/handler.rb

Instance Method Summary collapse

Instance Method Details

#perform(id, action, *args) ⇒ Object



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

def perform(id, action, *args)
  case id
  when 'new'
    obj = if args.any? && args.first.is_a?(Hash) && args.first['init_args']
      new args.first['init_args']
    else
      new
    end
    obj.send action
  when nil
    send action
  else
    find(id).send(action)
  end
end