How do you stringize/serialize Ruby code?

前端 未结 4 506
后悔当初
后悔当初 2020-12-16 13:32

I want to be able to write a lambda/Proc in my Ruby code, serialize it so that I can write it to disk, and then execute the lambda later. Sort of like...

x          


        
4条回答
  •  北荒
    北荒 (楼主)
    2020-12-16 14:09

    Ruby has the Marshal class that has a dump method that you can call.

    Take a look here:

    http://rubylearning.com/satishtalim/object_serialization.html

提交回复
热议问题