Class: Puppet::Parameter::Path
- Inherits:
-
Puppet::Parameter
- Object
- Puppet::Parameter
- Puppet::Parameter::Path
- Defined in:
- lib/vendor/puppet/parameter/path.rb
Constant Summary
Constants included from Util::Docs
Constants included from Util
Util::AbsolutePathPosix, Util::AbsolutePathWindows
Instance Attribute Summary
Attributes inherited from Puppet::Parameter
Attributes included from Util::Docs
Class Method Summary collapse
Instance Method Summary collapse
-
#unsafe_munge(paths) ⇒ Object
Likewise, this might be overridden, but by default…
-
#unsafe_validate(paths) ⇒ Object
This will be overridden if someone uses the validate option, which is why it just delegates to the other, useful, method.
- #validate_path(paths) ⇒ Object
Methods inherited from Puppet::Parameter
aliasvalue, defaultto, desc, #devfail, doc, #fail, format_value_for_display, #initialize, initvars, isnamevar, isnamevar?, isrequired, #log, #metaparam?, munge, #munge, #name, newvalues, nodefault, #noop, #pathbuilder, #provider, proxymethods, #remove, required?, #tags, #to_s, #unmunge, unmunge, validate, #validate, #value, #value=
Methods included from Util::Docs
#desc, #dochook, #doctable, #markdown_definitionlist, #markdown_header, #nodoc?, #pad, scrub
Methods included from Util
absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, #execfail, #execpipe, execute, execute_posix, execute_windows, logmethods, memory, path_to_uri, proxy, replace_file, safe_posix_fork, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, uri_to_path, wait_for_output, which, withumask
Methods included from Util::POSIX
#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid
Methods included from Util::MethodHelper
#requiredopts, #set_options, #symbolize_options
Methods included from Util::Logging
#clear_deprecation_warnings, #deprecation_warning, #send_log
Methods included from Util::LogPaths
Methods included from Util::Errors
#adderrorcontext, #devfail, #error_context, #exceptwrap, #fail
Constructor Details
This class inherits a constructor from Puppet::Parameter
Class Method Details
.accept_arrays(bool = true) ⇒ Object
4 5 6 |
# File 'lib/vendor/puppet/parameter/path.rb', line 4 def self.accept_arrays(bool = true) @accept_arrays = !!bool end |
.arrays? ⇒ Boolean
7 8 9 |
# File 'lib/vendor/puppet/parameter/path.rb', line 7 def self.arrays? @accept_arrays end |
Instance Method Details
#unsafe_munge(paths) ⇒ Object
Likewise, this might be overridden, but by default…
28 29 30 31 32 33 |
# File 'lib/vendor/puppet/parameter/path.rb', line 28 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 |
#unsafe_validate(paths) ⇒ Object
This will be overridden if someone uses the validate option, which is why it just delegates to the other, useful, method.
23 24 25 |
# File 'lib/vendor/puppet/parameter/path.rb', line 23 def unsafe_validate(paths) validate_path(paths) end |
#validate_path(paths) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/vendor/puppet/parameter/path.rb', line 11 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 |