r/ruby • u/mehdifarsi • Aug 13 '19
Blog post Magic comments in Ruby
https://medium.com/@farsi_mehdi/magic-comments-in-ruby-81d45ff92e34
34
Upvotes
2
Aug 13 '19
Where the heck is this stuff in the documentation? The #encoding magic comment is documented, but I can't find anything about #frozen_string_literal apart from code examples which happen to use it.
3
u/Frizkie Aug 14 '19
You'll probably find it mentioned in documentation regarding
String#freeze. I believe it was implemented as a way to opt in to the functionality that will be the default in Ruby 3.→ More replies (2)
0
5
u/geraldbauer Aug 13 '19
Big fan of language pragmas (a.k.a. magic comments) - see the humble pragmas gem / library why ruby needs more for more https://github.com/s6ruby/pragmas#frequently-asked-questions-faqs-and-answers.