3 ms·
Ruby’s symbols are undersold in terms of how useful they are and how they enable meta programming and DSL development. You can basically invent new language key
by ljm 4y ago
Ruby’s symbols are undersold in terms of how useful they are and how they enable meta programming and DSL development. You can basically invent new language keywords with them.
private def foo
“bar”
end
In this case, ‘def foo … end’ returns ‘:foo’, and ‘private’ is just another method that takes it as an argument and decorates the provided method. It’s not a special language keyword.