Skip to content

Commit

Permalink
Add documentation for boolean params
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Apr 22, 2013
1 parent a760515 commit 95e4226
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions source/guides/custom_types.markdown
Expand Up @@ -319,6 +319,22 @@ Lastly, validation and munging *only\** happen when a value is
assigned. They have no role to play at all during use of a given
value, only during assignment.

#### Boolean Parameters

Boolean parameters are common. To avoid repetition, some utilities are available:

{% highlight ruby %}
require 'puppet/parameter/boolean'
# ...
newparam(:force, :boolean => true, :parent => Puppet::Parameter::Boolean)
{% endhighlight %}

There are two parts here. The ``:parent => Puppet::Parameter::Boolean`` part
configures the parameter to accept lots of names for true and false, to make
things easy for your users. The ``:boolean => true`` creates a boolean method
on the type class to return the value of the parameter. In this example, the
method would be named ``force?``.

### Automatic Relationships

Your type can specify automatic relationships it can have with
Expand Down

0 comments on commit 95e4226

Please sign in to comment.