logo       

Re: Interesting behaviour: msg#02381

ruby-talk

Subject: Re: Interesting behaviour

Deepak Gole <deepak.gole8@xxxxxxxxx> writes:

> [Note: parts of this message were removed to make it a legal post.]
>
> When I does following thing on irb console
>
> def foo
> 1
> end
>
> foo ===>o/p 1
> foo.foo ===>o/p 1
> foo.foo.foo ===>o/p 1
> foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo............foo
> ===>o/p 1
>
> I got above o/p
>
>
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> But when I done same thing in Scite editor. I got error
>
> def foo
> 1
> end
>
> p foo
> p foo.foo =>o/p private method `foo' called for 1:Fixnum (NoMethodError)
>
>
> How ??

Why? Ask youself why foo.foo.foo --> 1 in the irb console!

Try: self.class
in both Scite and irb...

--
__Pascal Bourguignon__

Google Custom Search

News | Mail Home | sitemap | FAQ | advertise