Sha256: 965549c0c3e01b5d1954af9861c19aceda337bd2f756a3921835b94e8b7c998f
Contents?: true
Size: 873 Bytes
Versions: 3
Compression:
Stored size: 873 Bytes
Contents
require 'command_mapper/types/input_path' module CommandMapper module Types # # Represents a path to an existing directory. # class InputDir < InputPath # # Validates whether the directory exists. # # @param [Object] value # The given value to validate. # # @return [true, (false, String)] # Returns true if the value is valid, or `false` and a validation error # message if the value is not compatible. # # @api semipublic # def validate(value) valid, message = super(value) unless valid return valid, message end unless value.empty? unless File.directory?(value) return [false, "directory does not exist (#{value.inspect})"] end end return true end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
command_mapper-0.3.1 | lib/command_mapper/types/input_dir.rb |
command_mapper-0.3.0 | lib/command_mapper/types/input_dir.rb |
command_mapper-0.2.1 | lib/command_mapper/types/input_dir.rb |