Module: LiveAST::RubyParser::Unparser
- Defined in:
- lib/live_ast/ruby_parser/unparser.rb
Class Method Summary collapse
- .clone_sexp(sexp) ⇒ Object
-
.unparse(sexp) ⇒ Object
Return a ruby source string which reflects the given AST.
Class Method Details
.clone_sexp(sexp) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/live_ast/ruby_parser/unparser.rb', line 16 def self.clone_sexp(sexp) sexp.clone.map! do |elem| case elem when Sexp clone_sexp(elem) else elem end end end |
.unparse(sexp) ⇒ Object
Return a ruby source string which reflects the given AST.
12 13 14 |
# File 'lib/live_ast/ruby_parser/unparser.rb', line 12 def self.unparse(sexp) ::Ruby2Ruby.new.process(clone_sexp(sexp)) end |