diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/irb.rb | 2 | ||||
-rw-r--r-- | lib/irb/context.rb | 35 | ||||
-rw-r--r-- | lib/irb/init.rb | 7 |
3 files changed, 16 insertions, 28 deletions
diff --git a/lib/irb.rb b/lib/irb.rb index d8e1209f2c..bdf14f4170 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -542,7 +542,7 @@ module IRB if @context.echo? if assignment_expression?(line) if @context.echo_on_assignment? - output_value(@context.omit_on_assignment?) + output_value(@context.echo_on_assignment? == :truncate) end else output_value 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. diff --git a/lib/irb/init.rb b/lib/irb/init.rb index 44383609bd..e60b5266ff 100644 --- a/lib/irb/init.rb +++ b/lib/irb/init.rb @@ -52,7 +52,6 @@ module IRB # :nodoc: @CONF[:IGNORE_EOF] = false @CONF[:ECHO] = nil @CONF[:ECHO_ON_ASSIGNMENT] = nil - @CONF[:OMIT_ON_ASSIGNMENT] = nil @CONF[:VERBOSE] = nil @CONF[:EVAL_HISTORY] = nil @@ -178,10 +177,8 @@ module IRB # :nodoc: @CONF[:ECHO_ON_ASSIGNMENT] = true when "--noecho-on-assignment" @CONF[:ECHO_ON_ASSIGNMENT] = false - when "--omit-on-assignment" - @CONF[:OMIT_ON_ASSIGNMENT] = true - when "--noomit-on-assignment" - @CONF[:OMIT_ON_ASSIGNMENT] = false + when "--truncate-echo-on-assignment" + @CONF[:ECHO_ON_ASSIGNMENT] = :truncate when "--verbose" @CONF[:VERBOSE] = true when "--noverbose" |