How to implement a “callback” in Ruby?

后端 未结 7 1325
臣服心动
臣服心动 2020-12-12 10:00

I\'m not sure of the best idiom for C style call-backs in Ruby - or if there is something even better ( and less like C ). In C, I\'d do something like:

voi         


        
7条回答
  •  囚心锁ツ
    2020-12-12 10:31

    I know this is an old post, but others that come across this may find my solution helpful.

    http://chrisshepherddev.blogspot.com/2015/02/callbacks-in-pure-ruby-prepend-over.html

提交回复
热议问题