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.



609
610
611
# File 'lib/logstash/settings.rb', line 609

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

Instance Method Details

#coerce(value) ⇒ Object



619
620
621
622
623
624
# File 'lib/logstash/settings.rb', line 619

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

#set(value) ⇒ Object



613
614
615
616
617
# File 'lib/logstash/settings.rb', line 613

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