Method: Fluent::Counter::Validator#call

Defined in:
lib/fluent/counter/validator.rb

#call(data) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fluent/counter/validator.rb', line 50

def call(data)
  success = []
  errors = []

  if @empty && data.empty?
    errors << Fluent::Counter::InvalidParams.new('One or more `params` are required')
  else
    data.each do |d|
      begin
        @types.each { |type| dispatch(type, d) }
        success << d
      rescue => e
        errors << e
      end
    end
  end

  [success, errors]
end