I need to send 2 actions to the background. I could write :
myobject.delay.action1
myobject.delay.action2
But I can't be sure action2
starts after action1
finished, can I?
So instead, I could create a method on the fly.
def action1and2
myobject.action1
myobject.action2
end
myobject.delay.action1and2
but it feels stupid to create a named function to do this meaningless group, doesn't it?
So instead, inspired by JS, I thought of writing a lambda:
-> {
myobject.action1
myobject.action2
}
Can I delay such function? Or is there an alternative to my situation?
myobject.delay.instance_eval { action1; action2 }