From: James Britt Date: 2006-01-01T00:37:57+09:00 Subject: Re: Method for turning strings into code Christian Neukirchen wrote: > Erik Veenstra writes: > > >>>>What is the Ruby technique for turning strings into >>>>executable code? >>> >>>Via one of the various forms of eval. >> >>Uh, well, that's not the right answer. Eval evaluates >>(=executes) a string. It doesn't turn a string into executable >>code (=compile). > > > Wrap it in a lambda, then. If I have a string in a file, would we say it was executable code? Or does loading it into the Ruby interpreter make it executable code? What are the differences among require 'my-file-of-strings' load 'my-file-of-strings' and eval( IO.read( 'my-file-of-strings' ) ) James -- http://www.ruby-doc.org - Ruby Help & Documentation http://www.artima.com/rubycs/ - Ruby Code & Style: Writers wanted http://www.rubystuff.com - The Ruby Store for Ruby Stuff http://www.jamesbritt.com - Playing with Better Toys http://www.30secondrule.com - Building Better Tools