calling vs setting

i wouldn't lose any sleep over something like this regarding resource
consumption. it really doesn't matter.

even so,

id =

=> 1

=> 3


=> 3

They are the same anyway, so why add the extra line of code if it
really doesn't do anything?

Personally, is what i would use. Why? Because if I were
reading your code, everywhere you use, I would know exactly
what you meant. Using just 'id' can be a little ambiguous and can
lead to possible confusion as to intent. Even if you use 'user_id',
see the previous paragraph.

I would be more concerned about resource consumption if you were to
have a method which made a complicated calculation, in that case I
would use your example.

result_of_complicated_calculation = @obj.complicated_calculation
# use result_of_complicated_calculation in the rest of the code