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

Use frozen_string_literal: true #551

Merged
merged 4 commits into from
Nov 27, 2017

Conversation

aycabta
Copy link
Member

@aycabta aycabta commented Nov 8, 2017

Set frozen_string_literal: true.

Ruby 2.2 or earlier only has String#force_encoding for changing character encoding set without encode byte sequence, it changes receiver itself. Ruby 2.3 or later has frozen_striing_literal magic comment and String#new can take encoding keyword parameter for character encoding set without encode byte sequence.

So implements RDoc::Encoding.change_encoding and RDoc::Comment#encode! to disguise difference between #force_encoding and encoding keyword parameter of #new on String.

This Pull Request changes output of table_of_contents.html, but #549 conforms output to the same output.

@aycabta
Copy link
Member Author

aycabta commented Nov 8, 2017

This depends on #550 for that CI passes tests.

@aycabta aycabta force-pushed the use-frozen_string_literal-true branch from ef82462 to 4b28219 Compare November 11, 2017 23:18
@aycabta
Copy link
Member Author

aycabta commented Nov 15, 2017

Please wait to merge, I forgot to add magic comment to *.ry and *.kpeg.

@aycabta
Copy link
Member Author

aycabta commented Nov 15, 2017

Please merge #560 first.

@aycabta
Copy link
Member Author

aycabta commented Nov 15, 2017

Added frozen_string_literal: true to *.ry and *.kpeg.

@aycabta aycabta force-pushed the use-frozen_string_literal-true branch from b0e5adb to 498f24c Compare November 16, 2017 19:25
@aycabta
Copy link
Member Author

aycabta commented Nov 16, 2017

I'm sorry, rebased.

@hsbt
Copy link
Member

hsbt commented Nov 21, 2017

I will merge this after merging #556 and rebased.

@aycabta aycabta force-pushed the use-frozen_string_literal-true branch from 498f24c to d7db5f4 Compare November 21, 2017 12:09
Ruby 2.2 or earlier only has String#force_encoding for changing
character encoding set without encode byte sequence, it changes receiver
itself. Ruby 2.3 or later has frozen_striing_literal magic comment and
String#new can take encoding keyword parameter for character encoding
set without encode byte sequence.

So implements RDoc::Encoding.change_encoding and RDoc::Comment#encode!
to disguise difference between #force_encoding and encoding keyword
parameter of #new on String.
@aycabta aycabta force-pushed the use-frozen_string_literal-true branch from d7db5f4 to 8ffc114 Compare November 21, 2017 12:21
@hsbt
Copy link
Member

hsbt commented Nov 27, 2017

LGTM.

Note: I confirmed to update some assertions on test_rdoc_markup_pre_process.rb .

@hsbt hsbt merged commit b7449e4 into ruby:master Nov 27, 2017
@aycabta aycabta deleted the use-frozen_string_literal-true branch November 27, 2017 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants