filterfish / smith2

A complete rewrite of Smith
12 stars 7 forks source link

Reciever#to_proc should call Reciever#ack #9

Closed filterfish closed 9 years ago

filterfish commented 10 years ago

This is a very common idiom:

receiver('queue').subscribe do |payload, receiver|
  blah(payload) do
    receiver.ack
  end
end

By adding a to_proc method this could be reduced to:

receiver('queue').subscribe do |payload, receiver|
  blah(payload, &receiver) 
end