Class: EnvValidator::Types::FilePath

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



134
135
136
137
138
139
140
141
# File 'lib/env_validator/types.rb', line 134

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

  true
end