Class: Proc

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

Instance Method Summary collapse

Instance Method Details

#to_rubyObject



56
57
58
# File 'lib/parse_tree_extensions.rb', line 56

def to_ruby
  Ruby2Ruby.new.process(self.to_sexp).sub(/^\Aproc do/, 'proc {').sub(/end\Z/, '}')
end

#to_sexpObject



50
51
52
53
54
# File 'lib/parse_tree_extensions.rb', line 50

def to_sexp
  pt = ParseTree.new(false)
  sexp = pt.parse_tree_for_proc(self)
  Unifier.new.process(sexp)
end