[Ruby] eval question
Ben Speakmon
ben.speakmon at gmail.com
Mon Apr 30 15:12:19 PDT 2007
irb's scoping rules are different from straight ruby. It doesn't work
with my ruby 1.8.5 interpreter.
On 4/30/07, Ryan Davis <ryand-ruby at zenspider.com> wrote:
>
> 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"
>
> _______________________________________________
> Ruby at zenspider.com - Seattle.rb non-commercial list
> http://www.zenspider.com/seattle.rb
> http://www.zenspider.com/mailman/listinfo/ruby
>
More information about the Ruby
mailing list