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
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/live_ast/ruby_parser/unparser.rb', line 18 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.
14 15 16 |
# File 'lib/live_ast/ruby_parser/unparser.rb', line 14 def self.unparse(sexp) ::Ruby2Ruby.new.process(clone_sexp(sexp)) end |