diff options
author | aycabta <[email protected]> | 2020-09-19 04:25:59 +0900 |
---|---|---|
committer | aycabta <[email protected]> | 2020-09-19 05:13:08 +0900 |
commit | 555ea8334451c5ccd881e68b8b7ddc15745e66e3 (patch) | |
tree | 13ace7815499c910b2ff719d44a3f1fd4a83c071 /lib/irb/context.rb | |
parent | 7d9b4d3c61b090398b01ca66952eabc3aa22ca38 (diff) |
[ruby/irb] Drop OMIT_ON_ASSIGNMENT and add :truncate option for ECHO_ON_ASSIGNMENT
https://github.com/ruby/irb/commit/4c89b0775b
Diffstat (limited to 'lib/irb/context.rb')
-rw-r--r-- | lib/irb/context.rb | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/lib/irb/context.rb b/lib/irb/context.rb index 4f001729e1..0d358de6ff 100644 --- a/lib/irb/context.rb +++ b/lib/irb/context.rb @@ -131,12 +131,7 @@ module IRB @echo_on_assignment = IRB.conf[:ECHO_ON_ASSIGNMENT] if @echo_on_assignment.nil? - @echo_on_assignment = true - end - - @omit_on_assignment = IRB.conf[:OMIT_ON_ASSIGNMENT] - if @omit_on_assignment.nil? - @omit_on_assignment = true + @echo_on_assignment = :truncate end @newline_before_multiline_output = IRB.conf[:NEWLINE_BEFORE_MULTILINE_OUTPUT] @@ -256,27 +251,24 @@ module IRB attr_accessor :echo # Whether to echo for assignment expressions # - # Uses <code>IRB.conf[:ECHO_ON_ASSIGNMENT]</code> if available, or defaults to +true+. + # If set to +false+, the value of assignment will not be shown. + # + # If set to +true+, the value of assignment will be shown. + # + # If set to +:truncate+, the value of assignment will be shown and truncated. + # + # It defaults to +:truncate+. # # a = "omg" # #=> omg + # a = "omg" * 10 + # #=> omgomgomgomgomgomgomg... # IRB.CurrentContext.echo_on_assignment = false # a = "omg" + # IRB.CurrentContext.echo_on_assignment = true + # a = "omg" + # #=> omgomgomgomgomgomgomgomgomgomg attr_accessor :echo_on_assignment - # Whether to omit echo for assignment expressions - # - # Uses <code>IRB.conf[:OMIT_ON_ASSIGNMENT]</code> if available, or defaults to +true+. - # - # a = [1] * 10 - # #=> [1, 1, 1, 1, 1, 1, 1, 1, ... - # [1] * 10 - # #=> [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] - # IRB.CurrentContext.omit_on_assignment = false - # a = [1] * 10 - # #=> [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] - # [1] * 10 - # #=> [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] - attr_accessor :omit_on_assignment # Whether a newline is put before multiline output. # # Uses <code>IRB.conf[:NEWLINE_BEFORE_MULTILINE_OUTPUT]</code> if available, @@ -325,7 +317,6 @@ module IRB alias ignore_eof? ignore_eof alias echo? echo alias echo_on_assignment? echo_on_assignment - alias omit_on_assignment? omit_on_assignment alias newline_before_multiline_output? newline_before_multiline_output # Returns whether messages are displayed or not. |