mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/irb] Assert lvars_code doesn't include \n
Removing /\A.+\n/ could have an unexpected impact, depending on how
RubyLex.generate_local_variables_assign_code is implemented. It feels
like a too much assumption and the intention isn't immediately clear,
so I added these changes.
ccc07a35ce
This commit is contained in:
parent
a09f764ce5
commit
931bcd1b63
1 changed files with 3 additions and 3 deletions
|
@ -156,10 +156,10 @@ module IRB # :nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
if lvars_code
|
if lvars_code
|
||||||
colored.sub(/\A.+\n/, '')
|
raise "#{lvars_code.dump} should have no \\n" if lvars_code.include?("\n")
|
||||||
else
|
colored.sub!(/\A.+\n/, '') # delete_prefix lvars_code with colors
|
||||||
colored
|
|
||||||
end
|
end
|
||||||
|
colored
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue