From: Wybo Dekker Date: 2012-04-24T22:48:02+09:00 Subject: Re: gem-packed script with DATA section does not work On 2012-04-24 15:28, Xavier Noria wrote: > Did you receive my reply (I think it was the first one in the thread?) > with the BEGIN blocks? Do you know what is a BEGIN block? yes, but I didn't well understand it - now I see what you meant: #!/usr/bin/env ruby require 'optparse' name = 'Unknown' OptionParser.new do |opt| opt.on('-n','--name=STRING',String, 'set the name' ) do |v| name = v end end.parse! puts '',"data1: #{DATA1.result(binding)}", '',"data2: #{DATA2.result(binding)}" # __TEMPLATES__ BEGIN { require 'erb' DATA1 = ERB.new(<<-'DAT') Hello <%= name %> This is data 1, two lines. DAT DATA2 = ERB.new(<<-'DAT') This is data 2, 3 lines, including this one. DAT } -- Wybo