On Wed, 2008-11-12 at 14:04 -0800, Luke Kanies wrote:
> On Nov 9, 2008, at 3:47 AM, Brice Figureau wrote:
>
> > + # don't fetch lexer comment by default
> > + def use_docs
> > + false
> > + end
> > +
> > + # allow our subclass to specify they want documentation
> > + class << self
> > + def associates_doc
> > + define_method("use_docs") do
> > + true
> > + end
> > + end
> > + end
> > +
>
>
> This could be done more easily like this:
>
> def use_docs
> self.class.use_docs
>
> class << self
> attr_accessor :use_docs
> def associates_doc
> self.use_docs = true
> end
> end
>
> That is, use a class attribute, rather than dynamically redefining the
> method.
Yes, that's better. I tried it like this at first, for an unknown reason
I couldn't make it work.
Thanks,
--
Brice Figureau
Days of Wonder http://www.daysofwonder.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---