From: itsme213 Date: 2005-04-13T05:49:37+09:00 Subject: Re: gems info showing up in PhoneBook object ?? "Florian Gro�" wrote > What happens when you do 'p PhoneBook.new'? PhoneBook> irb Executing break point at phonebook.rb:45 in `do_irb' irb:001:0> p PhoneBook.new #, @stdin=#, @ >"12345677", "pfgasdsafg"=>nil, "steve 1234"=>nil, "mary"=>"123456"}> => nil irb:002:0> self.class => PhoneBook irb:003:0> p self ......... tons of stuff here, I've captured its head below irb:004:0> p self.inspect[0...400] "#\"delete\", \"exi\"=>\"exit\", \"fin\"=>\ "find\", \"del\"=>\"delete\", \"lis\"=>\"list\", \"exit\"=>\"exit\", \"add\"=>\"add\", \"help\"=>\"h elp\", \"list\"=>\"list\", \"a\"=>\"add\", \"de\"=>\"delete\", \"l\"=>\"list\", \"irb\"=>\"irb\", \" ad\"=>\"add\", \"fi\"=>\"find\", \"d\"=>\"delete\", \"dele\"=>\"delete\", \"delet\"=>\"delete\", \"h el\"=>\"help\", \"e\"=>\"exit\", \"she\"=>\"shell\", \"f\"=>\"find\", \"shel\"=>\"shell\", \"f" => nil > >>self > > > > #=> > > Something important is missing here. So much stuff prints out that my command-window buffer loses the front end. It does not print out indented; I used 'pp' for that. > > Also, what method does irb call to display an object? I tried defining to_s > > and inspect on PHoneBook but it had no effect. > > IRB uses .inspect in most cases, I redefined PhoneBook#inspect (in the irb breakpoint), and >> self still prints out the same stuff. Like I said, I may be doing something patently dumb.