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
Constructor Details
#initialize(name, default = nil, strict = true, possible_strings = []) ⇒ String
Returns a new instance of String.
405 406 407 408 |
# File 'lib/logstash/settings.rb', line 405 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
410 411 412 413 414 415 |
# File 'lib/logstash/settings.rb', line 410 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 |