Reputation: 461
I am using Net::HTTP to get a request from a Google API with a custom header:
req = Net::HTTP::Get.new(uri.request_uri, {'Authorization' => 'GoogleLogin auth=#{auth}'})
The #{auth}
is a variable that changes each time I run the program, so I made a variable with it, but the single quotes don't expand it. I can't change the single quotes to double quotes, because Google only accepts the header with single quotes.
Is there any way to expand the variable but keep the single quotes?
Upvotes: 0
Views: 75
Reputation: 3036
However, I can't change the single quotes to double quotes, because google only accepts the header with single quotes.
So hard to believe it.
Anyway, try Kernel%sprintf
or its shorter version just str % [arguments..]
. It will help.
Upvotes: 1