No release in over 3 years
Low commit activity in last 3 years
There's a lot of open issues
Easily add magic comments '# frozen_string_literal: true' followed by a blank line to multiple Ruby source files
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
>= 0
>= 0
 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.

Cloned from github.com/m-ryan/magic_encoding

Installation¶ ↑

gem install magic_frozen_string_literal
rbenv rehash

Usage¶ ↑

Run the tool from the command line:

magic_frozen_string_literal <directory>

this will prepend every “*.rb”, “*.ru”, “Rakefile”, “*.rake”, “Gemfile”, “*.gemspec”, “*.rabl”, “*.jbuilder”, “*.haml”, “*.slim” file in the given <directory> (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 <directory> 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