😊
[Feature #19428] ヒアドキュメントの識別子をインデントべーすにする提案
[Feature #19428] Adding a "piped heredoc" feature
- ヒアドキュメントでは以下のように任意の識別子で囲む必要がある
options = {
name: "My Nice Options",
description: <<~END,
This is a cool set of options.
You Can put what you like here.
END
details: <<~END,
Some more stuff here...
This will only be indented 2 spaces.
And this 4 spaces.
And this 2 spaces again.
Back to the "left" side.
END
}
- このチケットではヒアドキュメントに
<<|
みたいな記法を追加してインデントでヒアドキュメントの終了を検知するようにしたいというチケット
options = {
name: "My Nice Options",
description: <<|,
This is a cool set of options.
You Can put what you like here.
details: <<|,
Some more stuff here...
This will only be indented 2 spaces.
And this 4 spaces.
And this 2 spaces again.
Back to the "left" side.
}
- これは書きたいこともあるけど事故りそうな事もありそうだなあ
- ちなみに
<<~""
と書くと識別子が『空文字』になるので次のように書くことは現状でもできるみたい
options = {
name: "My Nice Options",
description: <<~"",
This is a cool set of options.
You Can put what you like here.
details: <<~"",
Some more stuff here...
This will only be indented 2 spaces.
And this 4 spaces.
And this 2 spaces again.
Back to the "left" side.
}
- これは知らなかった
Discussion