Class: UnboundMethod

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

Instance Method Summary collapse

Instance Method Details

#to_rubyObject



39
40
41
42
43
44
45
46
# File 'lib/parse_tree_extensions.rb', line 39

def to_ruby
  name = ProcStoreTmp.new_name
  ProcStoreTmp.send(:define_method, name, self)
  m = ProcStoreTmp.new.method(name)
  result = m.to_ruby.sub(/def #{name}(?:\(([^\)]*)\))?/,
                         'proc { |\1|').sub(/end\Z/, '}')
  return result
end