Search code examples
ruby-on-railsrubydelayed-jobirb

How can a Ruby class detect the process name that runs it?


I am using delayed_jobs to run Ruby classes, how can the Ruby detect the name (command) of the process that is running it?

any thoughts?


Solution

  • You can determine the name of the file using $0. You can even set the process name using it like so $0 = 'foo'Dave Thomas's blog post. If you want to get the command line args, you want to look at ARGV.