[#78633] ruby/spec needs help from CRuby committers — Benoit Daloze <eregontp@...>
Currently, ruby/spec is maintained mostly by individuals and enjoys the
13 messages
2016/12/13
[#78963] Re: ruby/spec needs help from CRuby committers
— Urabe Shyouhei <shyouhei@...>
2017/01/04
I did ask attendees of last developer meeting to join this
[#78642] Re: ruby/spec needs help from CRuby committers
— Eric Wong <normalperson@...>
2016/12/14
Benoit Daloze <eregontp@gmail.com> wrote:
[ruby-core:78708] [Ruby trunk Feature#13047] Use String literal instead of `String#+` for multiline pretty-printing of multiline strings
From:
mtsmfm@...
Date:
2016-12-17 14:21:49 UTC
List:
ruby-core #78708
Issue #13047 has been reported by Fumiaki Matsushima.
----------------------------------------
Feature #13047: Use String literal instead of `String#+` for multiline pretty-printing of multiline strings
https://bugs.ruby-lang.org/issues/13047
* Author: Fumiaki Matsushima
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
Multiline pretty-printing of multiline strings is introduced. (https://bugs.ruby-lang.org/issues/12664)
~~~ ruby
> pp "bundler.rb"=> "module Bundler\n BundlerError = Class.new(Exception)\n def self.setup\n end\nend\n"
{"bundler.rb"=>
"module Bundler\n" +
" BundlerError = Class.new(Exception)\n" +
" def self.setup\n" +
" end\n" +
"end\n"}
~~~
It is awesome but we can use String literal instead of `String#+`:
~~~ ruby
> pp "bundler.rb"=> "module Bundler\n BundlerError = Class.new(Exception)\n def self.setup\n end\nend\n"
{"bundler.rb"=>
"module Bundler\n" \
" BundlerError = Class.new(Exception)\n" \
" def self.setup\n" \
" end\n" \
"end\n"}
~~~
It seems that `pp` want to output evaluable snippet but we can override `String#+` so it may not work well.
Non-broken String will be:
~~~ ruby
> pp "bundler.rb"=> "module Bundler\nend\n"
{"bundler.rb"=> "module Bundler\n" "end\n"}
~~~
How do you think?
-------------
I tried to write patch but I can't find a way to append "\" to broken line only by current PP's API.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>