2017-10-06-ruby-magic-comments.md 631 B


title: "Ruby Magic Comments" description: > Ruby interpreter settings through comments. categories: posts

tags: [ruby]

There are two special ways to setup Ruby settings at the very top of a file.

Shebang

An interpreter directive mostly used on CLI programs, and scripts.

#!/usr/bin/env ruby -E UTF-8:UTF-8 --enable-frozen-string-literal

Option comments

These are expected at the very top of a file.

# -*- coding: utf-8 -*-
# -*- frozen_string_literal: true -*-

Find out more about ruby encodings{:rel="nofollow noopener noreferrer"}.