[Ruby] eval question

Ryan Davis ryand-ruby at zenspider.com
Mon Apr 30 15:05:08 PDT 2007


On Apr 30, 2007, at 13:09 , Aaron Patterson wrote:

> In this code, 'easy_lover' is defined, but for some reason
> 'phil_collins' is not.  First, why is that?  Second, can I make it so?
> You can have Easy Lover without Phil!

What version of ruby??

% irb
 >> eval(<<-END
     phil_collins = 'awesome'
     def easy_lover
       "She'll get a hold on you believe it"
     end
   END
 >> )
=> nil
 >> phil_collins
=> "awesome"
 >> RUBY_VERSION
=> "1.8.5"



More information about the Ruby mailing list