@temp
should not be "hello" the way you are doing it. If what you want to update @tmp
I would change the way my_function
works a bit:
def my_function
'hello'
end
@tmp = "blabla"
...
@tmp = my_function
Ruby is a "pass by value" language. This might help explain it a bit better than I can: https://www.ruby-forum.com/topic/41160
Basically your my_function
is only assigning foo
"hello" while in the function, it then returns foo, but does not reassign the passed in object.