# Freezolite

> A Ruby gem that turns the frozen_string_literal compile option automatically

- URL: https://evilmartians.com/opensource/freezolite
- GitHub: https://github.com/ruby-next/freezolite
- Authors: Vladimir Dementyev

---

Freezolite is a Ruby gem that turns the `frozen_string_literal` compile option on only for the specified files. Thus, it's like running Ruby with `--enable=frozen-string-literal`, but only for the files you own.

Tired of adding `# frozen_string_literals: true` to every file in your Ruby project, or running `rubocop -A` to make it do that for you? What if I told you that you can just add a single gem to your project and activate this option _for the project's files_ automatically (without enabling it globally)?

## Usage

Add the gem to your `Gemfile`:

```ruby
gem "freezolite"
```

And drop the following line to your application entry-point _after loading dependencies_ and before loading your application code. For example, in Rails, you can put it to `config/application.rb` after the `Bundler.require(...)` call:

```ruby
# config/application.rb

#...
Bundler.require(*Rails.groups)

require "freezolite/auto"

# <application configuration>
```

By default, the gem uses `Dir.pwd` to determine the project root. If you want to use a different directory or multiple directories, configure the gem like this:

```ruby
require "freezolite"

Freezolite.setup(
  # You must pass a list of glob patterns
  patterns: ["/path/to/dir1/*.rb", "/path/to/dir2/*.rb"],
  exclude_patterns: ["/path/to/dir1/vendor/*"]
)
```
