Class: LogStash::Setting::PositiveInteger

Inherits:
Integer 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 Integer

#coerce

Methods inherited from Coercible

#coerce, #set

Methods inherited from LogStash::Setting

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

Constructor Details

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

Returns a new instance of PositiveInteger.



375
376
377
378
379
380
381
382
383
# File 'lib/logstash/settings.rb', line 375

def initialize(name, default=nil, strict=true)
  super(name, default, strict) do |v|
    if v > 0
      true
    else
      raise ArgumentError.new("Number must be bigger than 0. Received: #{v}")
    end
  end
end