Module: LogStash::Inputs::Elasticsearch::PositiveWholeNumberValidator
- Included in:
- LogStash::Inputs::Elasticsearch
- Defined in:
- lib/logstash/inputs/elasticsearch.rb
Instance Method Summary collapse
Instance Method Details
permalink #validate_value(value, validator) ⇒ Array(true,Object), Array(false,String)
684 685 686 687 688 689 690 691 692 |
# File 'lib/logstash/inputs/elasticsearch.rb', line 684 def validate_value(value, validator) return super unless validator == :positive_whole_number is_number, coerced_number = super(value, :number) return [true, coerced_number.to_i] if is_number && coerced_number.denominator == 1 && coerced_number > 0 return [false, "Expected positive whole number, got `#{value.inspect}`"] end |