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

Get Octokit working with Ruby's immutable ("frozen") string literals functionality #1426

Merged
merged 4 commits into from Jun 6, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/octokit.yml
Expand Up @@ -43,6 +43,9 @@ jobs:
ruby-version: ${{ matrix.ruby }}
- name: Setup .netrc
run: chmod 600 spec/fixtures/.netrc
- name: Ruby 2.5 needs a newer RubyGems to support frozen-string-literal
if: ${{ matrix.ruby == '2.5' }}
run: gem update --system 2.7.11
- name: Install dependencies
run: |
bundle config set path .bundle/gems
Expand All @@ -51,4 +54,5 @@ jobs:
- name: Test with RSpec
env:
GITHUB_CI: 1
RUBYOPT: --enable-frozen-string-literal
run: bundle exec rspec -w
6 changes: 3 additions & 3 deletions lib/octokit/error.rb
Expand Up @@ -180,7 +180,7 @@ def response_error
def response_error_summary
return nil unless data.is_a?(Hash) && !Array(data[:errors]).empty?

summary = "\nError summary:\n"
summary = +"\nError summary:\n"
summary << data[:errors].map do |error|
if error.is_a? Hash
error.map { |k,v| " #{k}: #{v}" }
Expand All @@ -195,8 +195,8 @@ def response_error_summary
def build_error_message
return nil if @response.nil?

message = "#{@response[:method].to_s.upcase} "
message << redact_url(@response[:url].to_s) + ": "
message = +"#{@response[:method].to_s.upcase} "
message << redact_url(@response[:url].to_s.dup) + ": "
message << "#{@response[:status]} - "
message << "#{response_message}" unless response_message.nil?
message << "#{response_error}" unless response_error.nil?
Expand Down