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