Class: EnvValidator::Types::DirPath

Inherits:
Base
  • Object
show all
Defined in:
lib/env_validator/types.rb

Instance Method Summary collapse

Methods inherited from Base

#coerce

Instance Method Details

#validate(value) ⇒ Object



145
146
147
148
149
150
151
152
# File 'lib/env_validator/types.rb', line 145

def validate(value)
  path = value.to_s
  unless File.exist?(path) && File.directory?(path)
    raise TypeError, "Expected existing directory path, got #{value.inspect}"
  end

  true
end