From: Peter Zotov Date: 2012-04-24T05:57:32+09:00 Subject: Re: gem-packed script with DATA section does not work Ryan Davis писал 23.04.2012 22:58: > On Apr 23, 2012, at 04:49 , Wybo Dekker wrote: > >> That's clear, but does that mean there's no workaround? >> Can Ruby not be told that the DATA section is somewhere else? > > This is my ((slightly?) horrible) workaround: > > data = File.read(__FILE__).split(/__END__/).last This is better: data = File.read(__FILE__).split(/__END__/, 2).last 1.9.3p125 :001 > "a,b,c".split(",", 2) => ["a", "b,c"] 1.9.3p125 :002 > "a,b,c".split(",") => ["a", "b", "c"] -- WBR, Peter Zotov.