Created
March 3, 2021 03:09
-
-
Save ksmxxxxxx/d84c17c6c9e07fefd9dd228be20733c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#frozen_string_literal: true | |
heredoc_01 = <<~TEXT | |
. dummy_file_001.txt lorem_ipsum_10p.txt | |
.. dummy_file_002.txt lorem_ipsum_1p.txt | |
0123456789_0123456789_0123.md dummy_file_003.txt lorem_ipsum_2p.txt | |
0123456789_0123456789_0123456789_0123456789_012345.md dummy_file_004.txt lorem_ipsum_5p.txt | |
dir_foobar dummy_file_005.txt symlink_file.txt | |
TEXT | |
heredoc_02 = <<-TEXT | |
. dummy_file_001.txt lorem_ipsum_10p.txt | |
.. dummy_file_002.txt lorem_ipsum_1p.txt | |
0123456789_0123456789_0123.md dummy_file_003.txt lorem_ipsum_2p.txt | |
0123456789_0123456789_0123456789_0123456789_012345.md dummy_file_004.txt lorem_ipsum_5p.txt | |
dir_foobar dummy_file_005.txt symlink_file.txt | |
TEXT | |
heredoc_03 = <<TEXT | |
. dummy_file_001.txt lorem_ipsum_10p.txt | |
.. dummy_file_002.txt lorem_ipsum_1p.txt | |
0123456789_0123456789_0123.md dummy_file_003.txt lorem_ipsum_2p.txt | |
0123456789_0123456789_0123456789_0123456789_012345.md dummy_file_004.txt lorem_ipsum_5p.txt | |
dir_foobar dummy_file_005.txt symlink_file.txt | |
TEXT | |
p '<<~ インデントさせても無視される---------------------' | |
puts heredoc_01 | |
p '<<- インデントさせると出力もインデントされる---------' | |
puts heredoc_02 | |
p '<< インデントさせるとそのまま出力される--------------' | |
p 'ただし、ヒアドキュメント終了部分のTEXTの前にTabやspaceが入ってるとエラーになる' | |
puts heredoc_03 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment