Skip to content

Instantly share code, notes, and snippets.

@hlindberg
Created November 2, 2018 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hlindberg/015c433af4a835352ccdc3aeeaa1c2a0 to your computer and use it in GitHub Desktop.
Save hlindberg/015c433af4a835352ccdc3aeeaa1c2a0 to your computer and use it in GitHub Desktop.
Example: Puppet function calling new to create a Boolean from a String
Puppet::Functions.create_function(:any2bool) do
dispatch :any2bool do
param 'Any', :to_be_converted
end
def any2bool(to_be_converted)
call_function('new', Puppet::Pops::Types::PBooleanType::DEFAULT, to_be_converted)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment