diff options
author | Kenta Murata <mrkn@mrkn.jp> | 2020-01-16 13:13:35 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2020-01-21 09:51:16 +0900 |
commit | 51a8055d7db8a6ae35a9f624700c0910ec20aeb8 (patch) | |
tree | 0d718d09fa2668497e8735666b5c67f188472c28 /lib/irb | |
parent | f451bb5406878e1ac9ce9d37952f171837d0cb09 (diff) | |
download | ruby-51a8055d7db8a6ae35a9f624700c0910ec20aeb8.tar.gz |
[ruby/irb] Add newline_before_multiline_output
https://github.com/ruby/irb/commit/9eb1801a66
Diffstat (limited to 'lib/irb')
-rw-r--r-- | lib/irb/context.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/irb/context.rb b/lib/irb/context.rb index 686738cd40..218f7c6037 100644 --- a/lib/irb/context.rb +++ b/lib/irb/context.rb @@ -133,6 +133,11 @@ module IRB if @echo_on_assignment.nil? @echo_on_assignment = false end + + @newline_before_multiline_output = IRB.conf[:NEWLINE_BEFORE_MULTILINE_OUTPUT] + if @newline_before_multiline_output.nil? + @newline_before_multiline_output = true + end end # The top-level workspace, see WorkSpace#main @@ -253,6 +258,20 @@ module IRB # a = "omg" # #=> omg attr_accessor :echo_on_assignment + # Whether a newline is put before multiline output. + # + # Uses IRB.conf[:NEWLINE_BEFORE_MULTILINE_OUTPUT] if available, + # or defaults to +true+. + # + # "abc\ndef" + # #=> + # abc + # def + # IRB.CurrentContext.newline_before_multiline_output = false + # "abc\ndef" + # #=> abc + # def + attr_accessor :newline_before_multiline_output # Whether verbose messages are displayed or not. # # A copy of the default <code>IRB.conf[:VERBOSE]</code> @@ -287,6 +306,7 @@ module IRB alias ignore_eof? ignore_eof alias echo? echo alias echo_on_assignment? echo_on_assignment + alias newline_before_multiline_output? newline_before_multiline_output # Returns whether messages are displayed or not. def verbose? |