Skip to content

Instantly share code, notes, and snippets.

@ccooke
Created June 27, 2023 12:47
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 ccooke/54531e701ca76fea7120ce5a8e4c1afe to your computer and use it in GitHub Desktop.
Save ccooke/54531e701ca76fea7120ce5a8e4c1afe to your computer and use it in GitHub Desktop.
class collections::test {
# Contains tests of the collections constructs
# Define an iterator stack
collections::create { 'foo':
}
# Add a thing for the stack to do:
# collections::tap is a defined type that will create a notify resource containing its parameters
collections::register_action { 'Test: Add a define':
target => 'foo',
resource => 'collections::tap',
wrapped => true,
}
# Send four items through the stack
# In this case, it will create a 'collections::tap' for each one
[1, 2, 3, 4].each |$num| {
collections::append { "Add item ${num} to foo":
target => 'foo',
item => $num,
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment