title: "Ruby Magic Comments" description: > Ruby interpreter settings through comments. categories: posts
There are two special ways to setup Ruby settings at the very top of a file.
An interpreter directive mostly used on CLI programs, and scripts.
#!/usr/bin/env ruby -E UTF-8:UTF-8 --enable-frozen-string-literal
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"}.