Actually it depends what you want to do.

There is no "always do this" type of rule... We encourage understanding and e=
xperimentation and best practices to the limits of our understanding.

If your class was simply to output some values who's to say you can't instan=
tiate variables inside the class definition...=20

His code is just fine... Personally I'd never write code like that because i=
t doesn't support reuse very well and every time the class is defined and ru=
n, it prints out some stuff which isn't very helpful in all contexts.

Julian

On 27/02/2011, at 1:32 PM, botp <botpena / gmail.com> wrote:

> On Sun, Feb 27, 2011 at 9:29 AM, Marc Chanliau <marc.chanliau / gmail.com> w=
rote:
>> In Ruby it seems you can instantiate a class inside the class itself or
>> outside.
>=20
> that's ok, if you want to be my-class-centric rather than ruby's main
> centric. downside is, you cannot create instances of your
> class-centric class  outside without invoking your class-centric
> instances inside that class-centric class. in short, you're losing
> some ease-of-use features. but hey, maybe that is what you want and
> have a use for it, and ruby happily does not prevent you :)
>=20
>> What is the accepted convention?
>=20
> this is ruby. either there are no rules nor convention, or there are many :=
)
>=20
> best regards -botp
>=20