Sha256: 3b2df2740f7b04a31d9b162e987e19c00d87921b0988e067970c33f8ef27db46
Contents?: true
Size: 912 Bytes
Versions: 37
Compression:
Stored size: 912 Bytes
Contents
require 'puppet/parameter' class Puppet::Parameter::Path < Puppet::Parameter def self.accept_arrays(bool = true) @accept_arrays = !!bool end def self.arrays? @accept_arrays end def validate_path(paths) if paths.is_a?(Array) and ! self.class.arrays? then fail "#{name} only accepts a single path, not an array of paths" end fail("#{name} must be a fully qualified path") unless Array(paths).all? {|path| absolute_path?(path)} paths end # This will be overridden if someone uses the validate option, which is why # it just delegates to the other, useful, method. def unsafe_validate(paths) validate_path(paths) end # Likewise, this might be overridden, but by default... def unsafe_munge(paths) if paths.is_a?(Array) and ! self.class.arrays? then fail "#{name} only accepts a single path, not an array of paths" end paths end end
Version data entries
37 entries across 37 versions & 3 rubygems