Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Invoca/magic_frozen_string_literal
easily add '# frozen_string_literal: true' comments to the top of all your project's Ruby files
https://github.com/Invoca/magic_frozen_string_literal
Last synced: 3 months ago
JSON representation
easily add '# frozen_string_literal: true' comments to the top of all your project's Ruby files
- Host: GitHub
- URL: https://github.com/Invoca/magic_frozen_string_literal
- Owner: Invoca
- License: mit
- Created: 2015-08-21T23:27:33.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-02-11T13:12:57.000Z (9 months ago)
- Last Synced: 2024-04-14T16:08:20.032Z (7 months ago)
- Language: Ruby
- Homepage:
- Size: 61.5 KB
- Stars: 157
- Watchers: 9
- Forks: 16
- Open Issues: 4
-
Metadata Files:
- Readme: README.rdoc
Awesome Lists containing this project
README
= Magic_frozen_string_literal
Magic_frozen_string_literal is a little tool that allows you to quickly
add the magic comment that indicates that the file
can safely have its string literals frozen, as will be {the default in Ruby 3.0}[https://bugs.ruby-lang.org/issues/8976].Cloned from https://github.com/m-ryan/magic_encoding
== Installation
gem install magic_frozen_string_literal
rbenv rehash
== UsageRun the tool from the command line:
magic_frozen_string_literal
this will prepend every "*.rb", "*.ru", "Rakefile", "*.rake", "Gemfile", "*.gemspec", "*.rabl", "*.jbuilder", "*.haml", "*.slim" file in the given (recursively)
with the following magic comment followed by a blank line:# frozen_string_literal: true
(".haml" and ".slim" files will have a "-" prefix before the comment and no blank line after.)
The parameter is optional. It defaults to the current working directory.
Notes:
- existing +frozen_string_literal+ magic comments are replaced
- the rest of the file remains unchanged
- empty files are not touched
- if the file starts with #! (shebang), that line is preserved and the magic comment is added just below it