Marshaling lambdas in Ruby is dumb
And you really can’t do it…..not well at least.
ruby2ruby makes things easy. Go download all Seattle rb projects
>> require 'ruby2ruby'
=> true
>> proc { "woot" }
=> #
>> proc { "woot" }.to_ruby
=> "proc { \"woot\" }"
We can even save it!
>> require 'dm-core'
=> true
>> DataMapper.setup(:default, 'sqlite3::memory')
=> #
>> class Lol
>> include DataMapper::Resource
>> property :id, Integer, :serial => true
>> property :wut, Object
>> end
=> #
DataMapper.auto_migrate!
=> [Lol]
>> Lol.create(:wut => proc{"woot"}.to_ruby)
=> #
Its a string….no big deal. Here’s how you can get it out
>> l = Lol.first => #> >> m = eval l.wut => # >> m.call => "woot"