Writing custom functions in Ruby
You can write powerful and flexible functions using Ruby.
-
Custom functions in Ruby overview
Get started with an overview of Ruby custom functions. -
Ruby function signatures
Functions can specify how many arguments they expect, and a data type for each argument. The rule set for a function’s arguments is called a signature. -
Using special features in implementation methods
For the most part, implementation methods are normal Ruby. However, there are some special features available for accessing Puppet variables, working with provided blocks of Puppet code, and calling other functions. -
Iterative functions
You can use iterative types to write efficient iterative functions, or to chain together the iterative functions built into Puppet. -
Refactoring legacy 3.x functions
If you have Ruby functions written with the legacy 3.x API, refactor them to ensure that they work correctly with current versions of Puppet.