From: 12 34 Date: 2007-07-31T06:26:31+09:00 Subject: Re: Passing variables to a required file Alex Young wrote: > 12 34 wrote: >> >> Is there a better way? FWIW I'm "require'ing a modified example.rb file >> that is included in the Pashua app for creating a simple GUI for OS X. >> > Change your code. It'll be easier to do it now than to unpick > everything later. > > What you want (probably) is to wrap your code in the require'd file into > a class that you can instantiate with the relevant parameters in your > main script. > OK. For now that's the best solution for me, but later I will look at putting in a separate file. >> something in how it's used. > It's a heredoc marker. It's just another way of creating a multiline > string. The critical bit is the "< can put any identifier, and a string will be created from the content > between that line and the first occurrence of that marker on its own > later in the file. Thank you Alex and Thomas, now I see that a long string is being prepared to send to the Perl script or something like that. And I'm trying to get my Ruby variable in that string. They syntax in the string didn't quite look like Ruby, missing quotes and things. So EOS presumably means something like End of String and is commonly used but has no special meaning to Ruby. Confusing also to me that the word in front of < > HTH I think this will get me over the hump of using a file to prepare a string to send to some kind of Perl script (it's really an OS X app) to make a GUI. At the moment I was trying to recover the return from calling the "require." That problem will probably go away if I make it class or method. -- Posted via http://www.ruby-forum.com/.