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