diff options
author | Stan Lo <stan001212@gmail.com> | 2023-08-11 17:18:54 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-08-11 16:18:58 +0000 |
commit | 43721b1d4a474ff24612a62158b6c1cffc473335 (patch) | |
tree | 9c7eef3e2cb73e3c8f38d7681959567adb008546 /lib | |
parent | d3311e5cc3f4606afc9a12e4a4c7e1a19bd722d0 (diff) | |
download | ruby-43721b1d4a474ff24612a62158b6c1cffc473335.tar.gz |
[ruby/irb] Don't echo an expression's result when it ends with a
semicolon
(https://github.com/ruby/irb/pull/669)
https://github.com/ruby/irb/commit/50185c2833
Diffstat (limited to 'lib')
-rw-r--r-- | lib/irb.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/irb.rb b/lib/irb.rb index 839115d649..8aaefb2754 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -570,7 +570,8 @@ module IRB is_assignment = assignment_expression?(line) evaluate_line(line, line_no) - if @context.echo? + # Don't echo if the line ends with a semicolon + if @context.echo? && !line.match?(/;\s*\z/) if is_assignment if @context.echo_on_assignment? output_value(@context.echo_on_assignment? == :truncate) |