Reputation: 1099
I have a doubt concerning #{$$} inside a double quoted string, in concrete I have this string:
"#{command}#{$$}#{(Time.now.to_f * 1000).to_i}"
If I execute "#{$$}" in console I get an integer number but I would like to read an explanation to this.
Thank you !!
Upvotes: 0
Views: 99
Reputation: 4622
That would be the global process ID.
If you're asking what the #{...} syntax means, that prints the variable inside the braces. So if it would work like this..
command = "print"
puts "cmd: #{command}" #=> cmd: print
Upvotes: 3
Reputation: 124712
$$
is the interpreter's process ID.
Ruby has quite a few global variables you can use, see here.
Upvotes: 8