Class: LogStash::Config::AST::Hash
Instance Method Summary collapse
Methods inherited from Node
Instance Method Details
#compile ⇒ Object
358 359 360 361 |
# File 'lib/logstash/config/config_ast.rb', line 358 def compile validate! return "{" << recursive_select(HashEntry).collect(&:compile).reject(&:empty?).join(", ") << "}" end |
#find_duplicate_keys ⇒ Object
353 354 355 356 |
# File 'lib/logstash/config/config_ast.rb', line 353 def find_duplicate_keys values = recursive_select(HashEntry).collect { |hash_entry| hash_entry.name.text_value } values.find_all { |v| values.count(v) > 1 }.uniq end |
#validate! ⇒ Object
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
# File 'lib/logstash/config/config_ast.rb', line 337 def validate! duplicate_values = find_duplicate_keys if duplicate_values.size > 0 raise ConfigurationError.new( I18n.t("logstash.agent.configuration.invalid_plugin_settings_duplicate_keys", :keys => duplicate_values.join(', '), :line => input.line_of(interval.first), :column => input.column_of(interval.first), :byte => interval.first + 1, :after => input[0..interval.first] ) ) end end |