A Soiree into Symbols in Ruby | Stonecharioteer on Tech
14-Nov-2025 488
Okay, it’s a token of a sort, I think.
I’ve been befuddled when seeing :name instead of name and I didn’t know what it was at first. I spent some time reading Michael Hartl’s Learn Enough Ruby and I cannot really say I understood Symbols, so I wanted to RTFM.
The same Symbol object will be created for a given name or string for the duration of a program’s execution, regardless of the context or meaning of that name. Thus, if Fred is a constant in one context , a method in another, and a class in a third, the Symbol :Fred will be the same object in all three contexts.
A Soiree into Symbols in Ruby | Stonecharioteer on Tech #ruby #rubydeveloper #rubyonrails #Soiree #Symbols #Stonecharioteer https://rubyonrails.ba/link/a-soiree-into-symbols-in-ruby-stonecharioteer-on-tech