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.
447 448 449 450 |
# File 'lib/logstash/settings.rb', line 447 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
452 453 454 455 456 457 |
# File 'lib/logstash/settings.rb', line 452 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 |