Puppet Function: oradb::cleanpath

Defined in:
lib/puppet/functions/oradb/cleanpath.rb
Function type:
Ruby 4.x API

Overview

oradb::cleanpath(String $path)String

clean and return the path

Examples:

clean directory

oradb::cleanpath('/opt/oracle/db/11g/../') => '/opt/oracle/db'

Parameters:

  • path (String)

    some directory

Returns:

  • (String)

    Return the directory



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/puppet/functions/oradb/cleanpath.rb', line 3

Puppet::Functions.create_function(:oradb::cleanpath') do

  # clean and return the path
  # @param path some directory
  # @return [String] Return the directory
  # @example clean directory
  #   oradb::cleanpath('/opt/oracle/db/11g/../') => '/opt/oracle/db'
  dispatch :cleanpath do
    param 'String', :path
    # return_type 'String'
  end

  def cleanpath(path)
    path2 = Pathname.new(path)
    path2.cleanpath.to_s
  end
end