Skip to content

Instantly share code, notes, and snippets.

@WhatsARanjit
Created November 21, 2017 18:02
Show Gist options
  • Save WhatsARanjit/42ef84326eb4dc1598fb89cdcb20e27e to your computer and use it in GitHub Desktop.
Save WhatsARanjit/42ef84326eb4dc1598fb89cdcb20e27e to your computer and use it in GitHub Desktop.
Auto-loading with splat
class_name = 'foo::bar::baz'
parts = class_name.split('::')
module_name = parts.shift
file_name = parts.pop || 'init'
subdirs = parts || []
File.join('modules', module_name, 'manifests', *subdirs, "#{file_name}.pp")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment