From: Bihal Date: 2006-04-11T11:05:12+09:00 Subject: Re: Class Definition inside a method definition? Thanks for the explanation David, I'm sure it's close enough :P > Also, Pickaxe seems mildly wrong about the instance method definition > bit: > > irb(main):001:0> class Foo > irb(main):002:1> def bar > irb(main):003:2> def quux > irb(main):004:3> puts "Foo#quux" > irb(main):005:3> end > irb(main):006:2> end > irb(main):007:1> end > => nil > irb(main):008:0> foo = Foo.new > => # > irb(main):009:0> foo.quux > NoMethodError: undefined method `quux' for # > from (irb):9 > from :0 > irb(main):010:0> foo.bar > => nil > irb(main):011:0> foo.quux > Foo#quux > => nil > irb(main):012:0> Foo.new.quux > Foo#quux > => nil > > Is that 1st ed. or 2nd ed. you're quoting? Might have changed between > Ruby 1.6 > and 1.8. > > David Vallner 1st Edition. I've been tossing up whether I should ask the money guys around here to buy the 2nd Ed. I don't know how much it will help me to write this grammar than the first edition. -- Posted via http://www.ruby-forum.com/.