[Ruby] eval question
James Moore
banshee at banshee.com
Mon Apr 30 14:47:45 PDT 2007
Do you know that you're going to be defining phil_collins?
phil_collins = 'not so awesome' # this will be used in the eval
eval(<<END
phil_collins = 'awesome'
def easy_lover
"She'll get a hold on you believe it"
end
puts phil_collins
END
)
puts easy_lover
puts phil_collins
Or, what about just making phil a method too?
def phil_collins; 'awesome'; end
def easy_lover
"She'll get a hold on you believe it"
End
- James
More information about the Ruby
mailing list