From: "dklein (Dmitri Klein)" Date: 2022-01-21T21:36:04+00:00 Subject: [ruby-core:107236] [Ruby master Bug#18509] yajl.rb - (# TODO: this code smells, any ideas?) - "ArgumentError" Issue #18509 has been reported by dklein (Dmitri Klein). ---------------------------------------- Bug #18509: yajl.rb - (# TODO: this code smells, any ideas?) - "ArgumentError" https://bugs.ruby-lang.org/issues/18509 * Author: dklein (Dmitri Klein) * Status: Open * Priority: Normal * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Please clarify - can we trust this code in yajl-ruby gem yajl.rb file? class Encoder def self.encode(obj, *args, &block) **# TODO: this code smells, any ideas?** args.flatten! options = {} io = nil args.each do |arg| if arg.is_a?(Hash) options = arg elsif arg.respond_to?(:write) io = arg end end if args.any? new(options).encode(obj, io, &block) end end end ========= it generates following error: 2022-01-21 12:26:09 -0500 [warn]: fluent/root_agent.rb:187:emit_error_event: dump an error event: error_class=ArgumentError error="wrong number of arguments (1 for 0)" location="/opt/csw/lib/ruby/gems/2.0.0/gems/yajl-ruby-1.4.1/lib/yajl.rb:80:in `initialize'" tag="fluent.warn" time=1642785969 record={"error_class"=>"ArgumentError", "error"=>"wrong number of arguments (1 for 0)", "location"=>"/opt/csw/lib/ruby/gems/2.0.0/gems/yajl-ruby-1.4.1/lib/yajl.rb:80:in `initialize'", "tag"=>"fluent.debug", "time"=>1642785969, "record"=>{"message"=>"fluentd main process get SIGINT", "@timestamp"=>"2022-01-21T12:26:09-05:00"}, "message"=>"dump an error event: error_class=ArgumentError error=\"wrong number of arguments (1 for 0)\" location=\"/opt/csw/lib/ruby/gems/2.0.0/gems/yajl-ruby-1.4.1/lib/yajl.rb:80:in `initialize'\" tag=\"fluent.debug\" time=1642785969 record={\"message\"=>\"fluentd main process get SIGINT\", \"@timestamp\"=>\"2022-01-21T12:26:09-05:00\"}", "@timestamp"=>"2022-01-21T12:26:09-05:00"} -- https://bugs.ruby-lang.org/ Unsubscribe: