2023/10
Better Know A Ruby Thing #2: Constants
A fun thing about learning Ruby is that sometimes concepts that have the same name as in other languages have different behavior and purpose in Ruby.
Today: constants
They aren’t actually constant.
They aren’t only used for small strings or magic literals. They aren’t even mostly used for that in most Ruby programs.
Constants are one of the core pieces of Ruby and they aren’t super-well documented in the official site, so here we go…
Better Know A Ruby Thing #1: method_missing
Welcome to “Better Know A Ruby Thing”. In each one of these, we’re going to look at some feature of Ruby language, library, ecosystem, or culture and explain what it does, how it works, why it’s there, and any thing else that comes to mind.
First up, method_missing. If I may be poetic for a second, method_missing represents both infinite potential, and the possibility of a second chance when you can’t figure out what to do the first time around.