diff --git a/lib/fluent/config/configure_proxy.rb b/lib/fluent/config/configure_proxy.rb index 4db4fd4ef0..fbb6b63af8 100644 --- a/lib/fluent/config/configure_proxy.rb +++ b/lib/fluent/config/configure_proxy.rb @@ -274,7 +274,7 @@ def parameter_configuration(name, type = nil, **kwargs, &block) option_value_type!(name, opts, :deprecated, String) option_value_type!(name, opts, :obsoleted, String) if type == :enum - if !opts.has_key?(:list) || !opts[:list].is_a?(Array) || opts[:list].empty? || !opts[:list].all?{|v| v.is_a?(Symbol) } + if !opts.has_key?(:list) || !opts[:list].is_a?(Array) || opts[:list].empty? || !opts[:list].all?(Symbol) raise ArgumentError, "#{name}: enum parameter requires :list of Symbols" end end diff --git a/lib/fluent/config/types.rb b/lib/fluent/config/types.rb index 98e7d0d9d8..9c9ba89c8d 100644 --- a/lib/fluent/config/types.rb +++ b/lib/fluent/config/types.rb @@ -123,7 +123,7 @@ def self.enum_value(val, opts = {}, name = nil) s = val.to_sym list = opts[:list] - raise "Plugin BUG: config type 'enum' requires :list of symbols" unless list.is_a?(Array) && list.all?{|v| v.is_a? Symbol } + raise "Plugin BUG: config type 'enum' requires :list of symbols" unless list.is_a?(Array) && list.all?(Symbol) unless list.include?(s) raise ConfigError, "valid options are #{list.join(',')} but got #{val}" end