Class: CommandMapper::Types::InputDir
- Defined in:
- lib/command_mapper/types/input_dir.rb
Overview
Represents a path to an existing directory.
Instance Method Summary collapse
-
#validate(value) ⇒ true, (false, String)
Validates whether the directory exists.
Methods inherited from Type
Instance Method Details
#validate(value) ⇒ true, (false, String)
Validates whether the directory exists.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/command_mapper/types/input_dir.rb', line 22 def validate(value) valid, = super(value) unless valid return valid, end unless value.empty? unless File.directory?(value) return [false, "directory does not exist (#{value.inspect})"] end end return true end |