Class: Proc

Inherits:
Object
  • Object
show all
Defined in:
lib/r2c_hacks.rb

Constant Summary collapse

ProcStoreTmp =
Class.new

Instance Method Summary collapse

Instance Method Details

#to_rubyObject



40
41
42
43
44
45
# File 'lib/r2c_hacks.rb', line 40

def to_ruby
  ProcStoreTmp.send(:define_method, :myproc, self)
  m = ProcStoreTmp.new.method(:myproc)
  result = m.to_ruby.sub!(/def myproc\(([^\)]+)\)/, 'proc do |\1|')
  return result
end