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.
549 550 551 552 553 |
# File 'lib/logstash/settings.rb', line 549 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
555 556 557 558 559 560 561 562 563 |
# File 'lib/logstash/settings.rb', line 555 def coerce(value) if value.is_a?(Array) value elsif value.nil? [] else value.split(@token).map(&:strip) end end |