module Retrospec::Puppet::Parser::Functions
Public Class Methods
create_function(func_name, function_base = Function, &block)
click to toggle source
for puppet 4 functions
# File lib/retrospec/plugins/v1/plugin/generators/parsers/function.rb, line 69 def self.create_function(func_name, function_base = Function, &block) {:name => func_name } end
load_function(file)
click to toggle source
# File lib/retrospec/plugins/v1/plugin/generators/parsers/function.rb, line 73 def self.load_function(file) begin ::Puppet.initialize_settings rescue # do nothing otherwise calling init twice raises an error end @model = OpenStruct.new(:name => File.basename(file, '.rb'), :arity => nil, :doc => '', :type => nil, :class_methods => [], :instance_methods => [], :options => {}) f = eval(File.read(file)) @model.name = f[:name] @model.arity = f[:arity] @model.doc = f[:doc] @model.type = f[:type] @model end
newfunction(name, options = {}, &block)
click to toggle source
for puppet 3 functions
# File lib/retrospec/plugins/v1/plugin/generators/parsers/function.rb, line 64 def self.newfunction(name, options = {}, &block) options.merge({:name => name}) end