Joe Van Dyk 询问了Ruby邮件列表:
嗨,
在Ruby中,我猜你不能编组一个lambda/proc对象,对吗?在lisp或其他语言中这可能吗?
我想做什么:
l = lamda { ... }
Bj.submit "/path/to/ruby/program", :stdin => Marshal.dump(l)
Run Code Online (Sandbox Code Playgroud)
所以,我正在向BackgroundJob发送一个lambda对象,该对象包含要执行的操作的上下文/代码.但是,猜测这是不可能的.我最终编组了一个普通的ruby对象,其中包含程序运行后要执行的操作的说明.
乔
有没有办法在Ruby中访问符号表中的所有内容?我希望能够序列化或以其他方式保存程序运行的当前状态.为此,我似乎需要能够遍历范围内的所有变量.
我正在尝试运行Heckle,并且我一直收到错误:
> spec spec/controllers/my_controller_spec.rb --heckle MyController
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! exception= has a thick skin. There's nothing to heckle.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(Runs through several mutations...)
/home/developer/.gem/ruby/1.8/gems/heckle-1.4.3/lib/heckle.rb:603:in `current_code': undefined method `translate' for Ruby2Ruby:Class (NoMethodError)
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?
编辑:我忘记了宝石版本:
heckle (1.4.3)
ruby2ruby (1.2.3)
rails (2.3.2, 2.2.2)
rspec (1.2.6)
rspec-rails(1.2.6, 1.1.12)
Run Code Online (Sandbox Code Playgroud)