Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yajl.rb - (# TODO: this code smells, any ideas?) - "ArgumentError" #209

Open
dmitriklein opened this issue Jan 21, 2022 · 0 comments
Open

Comments

@dmitriklein
Copy link

Please clarify - can we trust this code in yajl-ruby gem yajl.rb file? (# TODO: this code smells, any ideas?)

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:ininitialize'", "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"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant