Class: LogStash::Setting::SplittableStringArray
- Inherits:
-
ArrayCoercible
- Object
- LogStash::Setting
- Coercible
- ArrayCoercible
- LogStash::Setting::SplittableStringArray
- Defined in:
- lib/logstash/settings.rb
Constant Summary collapse
- DEFAULT_TOKEN =
","
Instance Attribute Summary
Attributes inherited from LogStash::Setting
Instance Method Summary collapse
- #coerce(value) ⇒ Object
-
#initialize(name, klass, default, strict = true, tokenizer = DEFAULT_TOKEN, &validator_proc) ⇒ SplittableStringArray
constructor
A new instance of SplittableStringArray.
Methods inherited from Coercible
Methods inherited from LogStash::Setting
#==, #reset, #set, #set?, #strict?, #to_hash, #validate_value, #value
Constructor Details
#initialize(name, klass, default, strict = true, tokenizer = DEFAULT_TOKEN, &validator_proc) ⇒ SplittableStringArray
Returns a new instance of SplittableStringArray.
591 592 593 594 595 |
# File 'lib/logstash/settings.rb', line 591 def initialize(name, klass, default, strict=true, tokenizer = DEFAULT_TOKEN, &validator_proc) @element_class = klass @token = tokenizer super(name, klass, default, strict, &validator_proc) end |
Instance Method Details
#coerce(value) ⇒ Object
597 598 599 600 601 602 603 604 605 |
# File 'lib/logstash/settings.rb', line 597 def coerce(value) if value.is_a?(Array) value elsif value.nil? [] else value.split(@token).map(&:strip) end end |