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

Keyword arguments have to be explicitly double-splatted in Ruby 2.7+ #1084

Merged
merged 3 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bundler_args: --without benchmarks development
# Pin Rubygems to a working version. Sometimes it breaks upstream. Update now and then.
before_install:
- gem --version
- gem update --system 2.7.6 --quiet
- gem update --system --quiet || gem update --system 2.7.10 --quiet
- gem update bundler
- gem --version
- bash .travis_setup.sh
Expand Down
6 changes: 3 additions & 3 deletions lib/mysql2/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Error < StandardError
def initialize(msg, server_version = nil, error_number = nil, sql_state = nil)
@server_version = server_version
@error_number = error_number
@sql_state = sql_state ? sql_state.encode(ENCODE_OPTS) : nil
@sql_state = sql_state ? sql_state.encode(**ENCODE_OPTS) : nil

super(clean_message(msg))
end
Expand Down Expand Up @@ -91,9 +91,9 @@ def self.new_with_args(msg, server_version, error_number, sql_state)
# Returns a valid UTF-8 string.
def clean_message(message)
if @server_version && @server_version > 50500
message.encode(ENCODE_OPTS)
message.encode(**ENCODE_OPTS)
else
message.encode(Encoding::UTF_8, ENCODE_OPTS)
message.encode(Encoding::UTF_8, **ENCODE_OPTS)
end
end
end
Expand Down