From: Love U Ruby Date: 2013-03-26T15:54:48+09:00 Subject: Re: Need help on Kernel#eval D. Deryl Downey wrote in post #1103183: > Why? To what purpose? What exactly are you doing? What does this apply > to? What exactly are you trying to do? Show us the code where this would > matter to you. > > What *exactly* are you having trouble understanding? In what context did > you run across this? I have tried the below to understand the relationship between `eval` and `Binding` object,with local variable context. C:\>irb --simple-prompt >> def display >> eval("puts str",b) >> ^C >> def display(b) >> eval("puts str",b) >> end => nil >> str="hi" => "hi" >> display(binding) hi => nil >> str = "hello" => "hello" >> display(binding) hello => nil >> str = "good" => "good" >> str="bad" => "bad" >> display(binding) bad => nil >> The above is understood. But didn't make such simple example to understand for **methods, value of self, and possibly an iterator block that can be accessed in this context are all retained**. Thus asked you like experts to give me such snippet to understand those inside the **. -- Posted via http://www.ruby-forum.com/.