Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
Created April 1, 2012 17:14
Show Gist options
  • Save kwilczynski/2277144 to your computer and use it in GitHub Desktop.
Save kwilczynski/2277144 to your computer and use it in GitHub Desktop.
Variation on Puppet's range function -- flexible with zero-padding
matti@acrux ~/reject $ RUBYLIB=. cat - | puppet apply 2> /dev/null
notice range('abc01', 'abc10')
notice range('001def', '9def')
notice range('x1yz', '10')
notice: Scope(Class[main]): abc01 abc02 abc03 abc04 abc05 abc06 abc07 abc08 abc09 abc10
notice: Scope(Class[main]): 001def 002def 003def 004def 005def 006def 007def 008def 009def
notice: Scope(Class[main]): x1yz x2yz x3yz x4yz x5yz x6yz x7yz x8yz x9yz x10yz
notice: Finished catalog run in 0.05 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment