Class: Optout::File
- Inherits:
-
Object
- Object
- Optout::File
- Defined in:
- lib/optout.rb
Overview
Optout::File
is a validaton rule that can be used to check that an option’s value is a path to a file. By default Optout::File
does not check that the file exists. Instead, it checks that the file’s parent directory exists. This is done so that you can validate a path that will be created by the program the options are for. If you do want the file to exist just call the exists
method.
Validation rules can be combined:
Optout. do
on :path, "--path", Optout::File.exists.under("/home").named(/\.txt$/)
end
To validate directories use Optout::Dir.
Direct Known Subclasses
Class Method Summary collapse
-
.exists(wanted = true) ⇒ Object
If
wanted
is true the file must exist. -
.proxy_for ⇒ Object
:nodoc:.
Class Method Details
.exists(wanted = true) ⇒ Object
If wanted
is true the file must exist.
734 735 736 |
# File 'lib/optout.rb', line 734 def exists(wanted = true) proxy_for.new.exists(wanted) end |