Module: PuppetRepl::Support::Functions
- Included in:
- PuppetRepl::Support
- Defined in:
- lib/puppet-repl/support/functions.rb
Instance Method Summary collapse
-
#function_files ⇒ Object
returns a array of function files.
-
#function_map ⇒ Object
returns a map of functions.
Instance Method Details
#function_files ⇒ Object
returns a array of function files
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/puppet-repl/support/functions.rb', line 5 def function_files search_dirs = lib_dirs.map do |lib_dir| [File.join(lib_dir, 'puppet', 'functions', '**', '*.rb'), File.join(lib_dir, 'functions', '**', '*.rb'), File.join(lib_dir, 'puppet', 'parser', 'functions', '*.rb') ] end # add puppet lib directories search_dirs << [File.join(puppet_lib_dir, 'puppet', 'functions', '**', '*.rb'), File.join(puppet_lib_dir, 'puppet', 'parser', 'functions', '*.rb') ] Dir.glob(search_dirs.flatten) end |
#function_map ⇒ Object
returns a map of functions
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/puppet-repl/support/functions.rb', line 20 def function_map unless @functions do_initialize @functions = {} function_files.each do |file| obj = {} name = File.basename(file, '.rb') obj[:name] = name obj[:parent] = mod_finder.match(file)[1] @functions["#{obj[:parent]}::#{name}"] = obj end end @functions end |