ruby - can't modify frozen string (TypeError)

Posted by Straff on Stack Overflow See other posts from Stack Overflow or by Straff
Published on 2010-02-05T03:56:00Z Indexed on 2010/05/27 16:41 UTC
Read the original article Hit count: 178

Filed under:

Got

... '[]=': can't modify frozen string (TypeError)

when trying to modify what I thought was a copy of ARGV[0].

Same results for each of

arg = ARGV[ 0 ]
arg_cloned = ARGV[ 0 ].clone
arg_to_s = ARGV[ 0 ].to_s

arg[ 'x' ] = 'y'
arg_cloned[ 'x' ] = 'y'
arg_to_s[ 'x' ] = 'y'

© Stack Overflow or respective owner

Related posts about ruby