Puppet Function: :'stdlib::extname'
- Defined in:
- vendor_modules/stdlib/lib/puppet/functions/stdlib/extname.rb
- Function type:
- Ruby 4.x API
Overview
If Path is a Dotfile, or starts with a Period, then the starting Dot is not dealt with the Start of the Extension.
An empty String will also be returned, when the Period is the last Character in Path.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'vendor_modules/stdlib/lib/puppet/functions/stdlib/extname.rb', line 12 Puppet::Functions.create_function(:'stdlib::extname') do # @param filename The Filename # @return [String] The Extension starting from the last Period # @example Determining the Extension of a Filename # stdlib::extname('test.rb') => '.rb' # stdlib::extname('a/b/d/test.rb') => '.rb' # stdlib::extname('test') => '' # stdlib::extname('.profile') => '' dispatch :extname do param 'String', :filename return_type 'String' end def extname(filename) File.extname(filename) end end |