This is decidedly tangential to this thread's topic, but just briefly, here is 
what I mean (a "class instance" variable, or whatever you call it):

Puppet::Type.type(:blah).provide(:bloo) do
  @class_var = 'stuff'
  class << self
    attr_accessor :class_var
  end

  def some_instance_method
    self.class.class_var = 'newstuff'
  end
...



Eric


Date: Sun, 21 Jul 2013 20:24:02 -0400
Subject: Re: [Puppet-dev] finalize/cleanup for a provider
From: [email protected]
To: [email protected]

>From what I tried, instance variables stick with the single instance of the 
>provider, they don't carry across all providers of the same type.
Since, I'm trying to share across the various instances of a provider, I have 
to use a class variable. Unfortunately, I couldn't figure out how to do it 
without polluting the global namespace.

The native 'mount' provider does the same thing so I didn't dig much deeper to 
figure out how to work around it.
If someone does, I'd love to hear how.

Trevor                                    

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-dev.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to