文件操作 - keys.rb
返回文件管理
返回主菜单
删除本文件
文件: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/functions/keys.rb
编辑文件内容
# frozen_string_literal: true # Returns the keys of a hash as an Array # # @example Using `keys` # # ```puppet # $hsh = {"apples" => 3, "oranges" => 4 } # $hsh.keys() # keys($hsh) # # both results in the array ["apples", "oranges"] # ``` # # * Note that a hash in the puppet language accepts any data value (including `undef`) unless # it is constrained with a `Hash` data type that narrows the allowed data types. # * For an empty hash, an empty array is returned. # * The order of the keys is the same as the order in the hash (typically the order in which they were added). # Puppet::Functions.create_function(:keys) do dispatch :keys do param 'Hash', :hsh end def keys(hsh) hsh.keys end end
修改文件时间
将文件时间修改为当前时间的前一年
删除文件