Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
Created July 10, 2011 21:32
Show Gist options
  • Save kwilczynski/1074991 to your computer and use it in GitHub Desktop.
Save kwilczynski/1074991 to your computer and use it in GitHub Desktop.
module Puppet::Parser::Functions
newfunction(:testfunction, :type => :rvalue) do |*a|
p a
p a.class
end
end
$a = inline_template("<%= scope.function_testfunction('a', 'b', 'c') %>")
$b = inline_template("<%= scope.function_testfunction('a') %>")
$c = inline_template("<%= scope.function_testfunction(['a', 'b', 'c']) %>")
["a", "b", "c"]
Array
["a"]
Array
[["a", "b", "c"]]
Array
@kwilczynski
Copy link
Author

To make Puppet > 2.6.x ...

$a = inline_template("<%= Puppet::Parser::Functions.autoloader.loadall ; scope.function_testfunction('a', 'b', 'c') %>")
$b = inline_template("<%= Puppet::Parser::Functions.autoloader.loadall ; scope.function_testfunction('a', 'b', 'c') %>")
$c = inline_template("<%= Puppet::Parser::Functions.autoloader.loadall ; scope.function_testfunction(['a', 'b', 'c']) %>")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment