Module: Pure::Parser::RubyParser::DupSexp

Included in:
Processor
Defined in:
lib/pure/parser/impl/ruby_parser.rb

Class Method Summary collapse

Class Method Details

.dup_sexp(sexp) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/pure/parser/impl/ruby_parser.rb', line 21

def dup_sexp(sexp)
  if sexp.is_a? Sexp or sexp.is_a? Array
    array = sexp.map { |sub_sexp|
      dup_sexp(sub_sexp)
    }
    Sexp.new.replace(array)
  else
    sexp
  end
end