# defined a method name str, not set a String value
def str(value)
['www.google.com/v1/cols?limit=100&offset=', value].join
end
str(10) #=> "www.google.com/v1/cols?limit=100&offset=10"
str(30) #=>"www.google.com/v1/cols?limit=100&offset=30"
The problem is that the string interpolation happens only once: when the Interpreter evaluates the string interpolation expression.
@cavalon gave you one alternative to interpolation.
Another solution is to make the evaluation of the interpolation dynamically. You can do that simply by defining a function with the string interpolation in it’s body, so each time the function is called, the Interpreter evaluates the expression again: