Project

General

Profile

Actions

Bug #16687

closed

Ripper.slice FrozenError in ruby 2.5

Added by Dan0042 (Daniel DeLorme) about 4 years ago. Updated about 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.6p201 (2019-08-28 revision 67793) [x86_64-linux]
[ruby-core:97447]

Description

Trying the example from the Ripper.slice documentation:

require 'ripper'
p Ripper.slice('def m(a) nil end', 'ident')  
#=> /opt/ruby/2.5/lib/ruby/2.5.0/ripper/lexer.rb:199:in `concat': can't modify frozen String (FrozenError)

Just needs to change lexer.rb:195 from buf = '' to buf = +''

Actions

Also available in: Atom PDF

Like0
Like0Like0