From: 7stud -- Date: 2011-04-18T07:47:46+09:00 Subject: Re: Telnet "More?" Eric T. wrote in post #993311: > In a slightly unrelated question, I don't understand why I have to do > this: > > out = lambda do |c| print c end > t.login('someusername', 'somepassword', &out) > t.cmd('dir', &out) > t.cmd('dir', &out) > > Rather than simply this: > > t.login('someusername', 'somepassword', &print) > t.cmd('dir', &print) > t.cmd('dir', &print) > > Seems kinda pointless to make a function... Which function are you referring to?? > which does nothing but pass > it's arguments unaltered to another function. Yes, that would be pointless, but where does such a function appear in your code? In your code, the & does two things: 1) It calls to_proc() on the specified object. print() is a method of the Kernel module, and Kernel doesn't define to_proc(). 2) It tells ruby to use the Proc object as a block. -- Posted via http://www.ruby-forum.com/.