2008년 01월 23일
here doc
기본
string = <<END_OF_STRING
You can enter as many
lines as you like here
but will end this string
with...
END_OF_STRING
Dynamic String
planet = 'Earth'
string = <<END_OF_STRING
Hello, #{planet}
END_OF_STRING
puts string # Hello, Earth
Indenting
: Tag가 Indent를 가진 경우 루비는 기본적으로 인식하지 못하고 에러난다.
Tag에 '-'를 붙여주면 된다.
Indent 깊이에 관계없이 '-' 는 하나만 붙인다.
string = <<-END_OF_STRING
Notice the hyphen after the
<< characters above
END_OF_STRING
string = <<END_OF_STRING
You can enter as many
lines as you like here
but will end this string
with...
END_OF_STRING
Dynamic String
planet = 'Earth'
string = <<END_OF_STRING
Hello, #{planet}
END_OF_STRING
puts string # Hello, Earth
Indenting
: Tag가 Indent를 가진 경우 루비는 기본적으로 인식하지 못하고 에러난다.
Tag에 '-'를 붙여주면 된다.
Indent 깊이에 관계없이 '-' 는 하나만 붙인다.
string = <<-END_OF_STRING
Notice the hyphen after the
<< characters above
END_OF_STRING
# by | 2008/01/23 11:37 | 트랙백



☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]