Skip to content

Instantly share code, notes, and snippets.

@ccooke
Created March 14, 2024 08:21
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/159f9728a857c2817ec3f80f22ee71d6 to your computer and use it in GitHub Desktop.
Save ccooke/159f9728a857c2817ec3f80f22ee71d6 to your computer and use it in GitHub Desktop.
# @summary A short summary of the purpose of this class
#
# A description of what this class does
#
# @example
# include collections::test
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,
}
# Register a defined type that will process all of the collected items, rather than being called
# once per item. As with actions, multiple executors may be defined
collections::register_executor { 'Test: Add an executor':
target => 'foo',
resource => 'collections::debug_list',
context => {}
}
# 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