I’ve never done a thing with ruby script before, and was hoping someone here would have a quick answer. I’m on a time sensitive project, and was hoping SO could provide some insight.
I’ve googled around here, and sought out some ruby script guides, and think I understand most of the following code, but there are a few things I wasn’t able to figure out.
I have the following exceprt from a ruby script, and I just need to know what it’s doing:
where docName and document_name are a string of a file path
case docName
when /^QRX/ then document_name = "/TRPRR/#{docName}"
when /^BVN/ then document_name = "/TRPRR/#{docName}"
....
There are a bunch of other cases, and I understand case statements. I don’t understand the following:
Is the /^QRX/ some kind of regular expression or something? And what does the #{docName} do?
Yes, the
/^QRX/, etc. performs a regular expression match againstdocName, and if it matches, it performs the code following.The
#{docName}is how ruby handles string interpolation: