Class: LogStash::Setting::Modules

Inherits:
Coercible 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?, #strict?, #to_hash, #validate_value, #value

Constructor Details

#initialize(name, klass, default = nil) ⇒ Modules

Returns a new instance of Modules.



567
568
569
# File 'lib/logstash/settings.rb', line 567

def initialize(name, klass, default = nil)
  super(name, klass, default, false)
end

Instance Method Details

#coerce(value) ⇒ Object



577
578
579
580
581
582
# File 'lib/logstash/settings.rb', line 577

def coerce(value)
  if value.is_a?(@klass)
    return value
  end
  @klass.new(value)
end

#set(value) ⇒ Object



571
572
573
574
575
# File 'lib/logstash/settings.rb', line 571

def set(value)
  @value = coerce(value)
  @value_is_set = true
  @value
end