(imported from commit bb3ccac0dd0cc5688be0f1487092cbe34b107002)
This commit is contained in:
Tim Abbott
2012-09-20 14:55:17 -04:00
parent 5a4a5b0fc0
commit d757b630bf
30 changed files with 693 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
# dirname(string) : string
# dirname(string[]) : string[]
#
# Returns all components of the filename given as argument except the last
# one. The filename must be formed using forward slashes (``/..) regardless of
# the separator used on the local file system.
module Puppet::Parser::Functions
newfunction(:dirname, :type => :rvalue) do |args|
if args[0].is_a?(Array)
args.collect do |a| File.dirname(a) end
else
File.dirname(args[0])
end
end
end