Class: LogStash::Setting::String
- Inherits:
-
LogStash::Setting
- Object
- LogStash::Setting
- LogStash::Setting::String
- Defined in:
- lib/logstash/settings.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from LogStash::Setting
Instance Method Summary collapse
-
#initialize(name, default = nil, strict = true, possible_strings = []) ⇒ String
constructor
A new instance of String.
- #validate(value) ⇒ Object
Methods inherited from LogStash::Setting
#==, #reset, #set, #set?, #strict?, #to_hash, #validate_value, #value
Methods included from Util::Loggable
included, #logger, #slow_logger
Constructor Details
#initialize(name, default = nil, strict = true, possible_strings = []) ⇒ String
Returns a new instance of String.
378 379 380 381 |
# File 'lib/logstash/settings.rb', line 378 def initialize(name, default=nil, strict=true, possible_strings=[]) @possible_strings = possible_strings super(name, ::String, default, strict) end |
Instance Method Details
#validate(value) ⇒ Object
383 384 385 386 387 388 |
# File 'lib/logstash/settings.rb', line 383 def validate(value) super(value) unless @possible_strings.empty? || @possible_strings.include?(value) raise ArgumentError.new("Invalid value \"#{value}\". Options are: #{@possible_strings.inspect}") end end |