Skip to content

Commit

Permalink
Merge pull request #1426 from octokit/frozen-string-literal
Browse files Browse the repository at this point in the history
Get Octokit working with Ruby's immutable ("frozen") string literals functionality
  • Loading branch information
timrogers committed Jun 6, 2022
2 parents 4c0bee8 + d713396 commit 6202e72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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

0 comments on commit 6202e72

Please sign in to comment.