Method: Magent::AsyncChannel#push

Defined in:
lib/magent/async_channel.rb

#push(target, method, priority) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/magent/async_channel.rb', line 3

def push(target, method, priority)
  encode_args(method[1])

  if target.kind_of?(Class)
    enqueue([target.to_s, nil, method], priority)
  elsif target.class.respond_to?(:find) && target.respond_to?(:id)
    enqueue([target.class.to_s, target.id, method], priority)
  else
    raise ArgumentError, "I don't know how to handle #{target.inspect}"
  end
end