Created
November 21, 2017 18:02
-
-
Save WhatsARanjit/42ef84326eb4dc1598fb89cdcb20e27e to your computer and use it in GitHub Desktop.
Auto-loading with splat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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