Skip to content

Commit

Permalink
Added declaration of frozen string literals
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Jul 1, 2017
1 parent ab19d38 commit 2a5f102
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions rake.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
require 'rake/version'

Expand Down

4 comments on commit 2a5f102

@nisevi
Copy link

@nisevi nisevi commented on 2a5f102 Jan 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @hsbt, I was wondering, after adding this magic comment here, do you still need to freeze all the other strings that are being frozen in this file?

@esparta
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does because backward compatibility (kind-of): The frozen_string_literal magic comment only applies to Ruby 2.3 and beyond (being default on Ruby 3), but this gem is still supported down from Ruby 2.0.

@nisevi
Copy link

@nisevi nisevi commented on 2a5f102 Jan 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome @esparta now I understand 👍

Thank you!

@esparta
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're welcome

Please sign in to comment.