Class: LogStash::Filters::Jdbc::Validatable

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/filters/jdbc/validatable.rb

Direct Known Subclasses

Column, DbObject, Loader, LoaderSchedule

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Validatable

Returns a new instance of Validatable.



17
18
19
20
21
22
23
24
# File 'lib/logstash/filters/jdbc/validatable.rb', line 17

def initialize(options)
  pre_initialize(options)
  @options = options
  @valid = false
  @option_errors = []
  parse_options
  post_initialize
end

Class Method Details

.find_validation_errors(options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/logstash/filters/jdbc/validatable.rb', line 4

def self.find_validation_errors(options)
  array_of_options = Array(options)
  errors = []
  array_of_options.each do |options|
    instance = new(options)
    unless instance.valid?
      errors << instance.formatted_errors
    end
  end
  return nil if errors.empty?
  errors.join("; ")
end

Instance Method Details

#formatted_errorsObject



30
31
32
# File 'lib/logstash/filters/jdbc/validatable.rb', line 30

def formatted_errors
  @option_errors.join(", ")
end

#valid?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/logstash/filters/jdbc/validatable.rb', line 26

def valid?
  @valid
end