Sha256: f077886ff2a10c8d6f11fbd837914ed1a6c709bc4135b33eef0d40dc904bb16f

Contents?: true

Size: 414 Bytes

Versions: 9

Compression:

Stored size: 414 Bytes

Contents

module CLIUtils
  # A Validator to verify whether a Pref answer
  # is a local filepath that exists.
  class FilepathExistsValidator < PrefValidator
    # Runs the Validator against the answer.
    # @param [Object] text The "text" to evaluate
    # @return [String]
    def validate(text)
      @is_valid = Pathname.new(text.to_s).exist?
      @message = "Path does not exist locally: #{ text }"
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cliutils-2.1.4 lib/cliutils/prefs/pref_validators/filepath_exists_validator.rb
cliutils-2.1.3 lib/cliutils/prefs/pref_validators/filepath_exists_validator.rb
cliutils-2.1.2 lib/cliutils/prefs/pref_validators/filepath_exists_validator.rb
cliutils-2.1.1 lib/cliutils/prefs/pref_validators/filepath_exists_validator.rb
cliutils-2.1.0 lib/cliutils/prefs/pref_validators/filepath_exists_validator.rb
cliutils-2.0.3 lib/cliutils/prefs/pref_validators/filepath_exists_validator.rb
cliutils-2.0.2 lib/cliutils/prefs/pref_validators/filepath_exists_validator.rb
cliutils-2.0.1 lib/cliutils/prefs/pref_validators/filepath_exists_validator.rb
cliutils-2.0.0 lib/cliutils/prefs/pref_validators/filepath_exists_validator.rb