Sha256: 03d0db7876682e3201d124fcb63b86aefecb13b080dd1a91abbac7f9acbad521

Contents?: true

Size: 829 Bytes

Versions: 3

Compression:

Stored size: 829 Bytes

Contents

#
# interpolate.rb
#
# Interpolate values from one hash to another for configuration injection.
#
module Puppet::Parser::Functions
  newfunction(:interpolate, :type => :rvalue, :doc => <<-EOS
This function interpolates values from one hash to another for configuration injections.
    EOS
) do |args|
    
    value = nil
    CORL.run do
      raise(Puppet::ParseError, "interpolate(): Define at least a property name with optional source configurations " +
        "given (#{args.size} for 2)") if args.size < 1
      
      value   = args[0]
      data    = ( args.size > 1 ? args[1] : {} )
      options = ( args.size > 2 ? args[2] : {} )
      
      config = CORL::Config.init_flat(options, [ :data, :interpolate ])
      value  = CORL::Util::Data.interpolate(value, data, config.options)
    end
    return value
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
corl-0.4.2 lib/puppet/parser/functions/interpolate.rb
corl-0.4.1 lib/puppet/parser/functions/interpolate.rb
corl-0.4.0 lib/puppet/parser/functions/interpolate.rb