As far as I know "inner classes" are an anti pattern(for the lack of a
better term)

Each class should live in its own file.

More than one class per file is discouraged
On Sep 16, 2014 7:00 PM, "Francois Lafont" <[email protected]>
wrote:

> Hi,
>
> About the "params" pattern, I had read this article :
>
> http://garylarizza.com/blog/2014/02/17/puppet-workflow-part-1/
>
> Suppose I want to use the "params" pattern in my modulees (ok there
> really is no *better* way but imagine I want to use this way). In
> the article, the author explains that, for the "top level" class of
> my module, I can use this way :
>
>     class my_module (
>       $var1 = $my_module::params::var1,
>       $var2 = $my_module::params::var2,
>       $var3 = $my_module::params::var3,
>       ...
>     ) inherits my_module::params {
>         # The body of the class
>     }
>
> Ok, I understand that. But what about an internal class of my module?
> If I want to define an internal class (my_module/internal.pp) which
> will be declared in the "my_module" class, what is the "best" way?
>
> In the internal class, I want probably to use some parameters of
> the "my_module" class and some variables of the my_module::params
> class. How can I do that? Like below? I have doubts because in this
> cas I have lot of inheritance and I understand that it was not a
> good thing.
>
>     # Definition of the my_module::internal class
>     # I need to the value of $var2 and $var3 of "he "top level" class
> my_module
>     # and I need to parameters in my_module::params.
>     class my_module::internal (
>       $var2,
>       $var3,
>     ) inherits my_module::params {
>       # The body of the class
>     }
>
>
>     # Declaration of my_module::internal class in the my_module class
>     class my_module (
>       $var1 = $my_module::params::var1,
>       $var2 = $my_module::params::var2,
>       $var3 = $my_module::params::var3,
>       ...
>     ) inherits my_module::params {
>         # The body of the class
>
>
>         class my_module::internal {
>           var2 => $var2,
>           var3 => $var3,
>         }
>
>     }
>
> Thanks in advance for your help.
> François Lafont
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/5418CF25.8070101%40gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAApMPgy-7Ab%2Bsw5DZwNc3PQh2xtn%2BxiCC%3DEs5PB-XOpT06pY2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to