On 01/27/2016 10:11 AM, Gareth Rushgrove wrote:
I nearly always having something
like:


def self.prefetch(resources)
   instances.each do|prov|
     if resource = resources[prov.name]
       resource.provider = prov
     end
   end
end

Where instances returns an array of objects created using new.

def self.instances
   some_list_of_things.collect do|obj|
     new({
      name: obj.name,
       ensure: :present,
     })
   end
end


Yeah. Come to think of it - that's so boilerplate-y...should we abstract from this? Can we? I'm thinking of a kind of provider DSL call that will take care of creating these methods, and/or make that very simple.

Thoughts?

Cheers,
Felix

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/56BD1306.2070103%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to