Class: LogStash::Setting::ExistingFilePath

Inherits:
LogStash::Setting show all
Defined in:
lib/logstash/settings.rb

Instance Attribute Summary

Attributes inherited from LogStash::Setting

#default, #name

Instance Method Summary collapse

Methods inherited from LogStash::Setting

#==, #reset, #set, #set?, #strict?, #to_hash, #validate_value, #value

Constructor Details

#initialize(name, default = nil, strict = true) ⇒ ExistingFilePath

Returns a new instance of ExistingFilePath.



426
427
428
429
430
431
432
433
434
# File 'lib/logstash/settings.rb', line 426

def initialize(name, default=nil, strict=true)
  super(name, ::String, default, strict) do |file_path|
    if !::File.exists?(file_path)
      raise ::ArgumentError.new("File \"#{file_path}\" must exist but was not found.")
    else
      true
    end
  end
end