I was looking at some code examples and I came across this line:
puts "child #$$ accepting..."
which outputs
>> child 7231 accepting...
It looks like $$ is the PID and it’s leveraging some shorthand for the normal #{$$} string interpolation syntax. I can’t find the documentation for this though. I’m curious what other short hand tricks are available (or going to confuse me).
Where are the docs? Why is this special?
Ruby allows you to omit the braces for global (
$var), instance (@var), and class (@@var) variables when doing string interpolation.