As I read Thomas&Hunt p. 205, Ruby should build a quoted string with the
text from <<XXX to the next XXX. But that doesn't happen with some quoted
strings in that block, as follows. Why?
# F:\_Projects_Current\_Projects_Ruby\A009-Comments\Comments.rb
for i in 1..3
puts i.to_s
end
print <<TEST
xxxx
yyyy
"abc"
class A
def initialize(*args, &block)
puts '---'
puts "args <#{ args.inspect }>"
block.call if block
end
end
TEST
<<OUTPUT
>ruby Comments.rb
Test
1
2
3
Comments.rb:15: undefined local variable or method `args' for main:Object
(NameError)
>Exit code: 1
OUTPUT
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.665 / Virus Database: 428 - Release Date: 5/1/2004