Is there any performance implications if I do either of these:
def do_something(user, article)
...
end
versus
def do_someth
No, Ruby never passes by reference. Ruby is pass-by-value. Always. No exceptions.
def is_Ruby_pass_by_value_or_reference?(parameter)
parameter = 'Ruby is pass-by-reference.'
end
var = 'Ruby is pass-by-value. Always. No exceptions.'
is_Ruby_pass_by_value_or_reference?(var)
puts var
# Ruby is pass-by-value. Always. No exceptions.
If Ruby were pass-by-reference, this would print Ruby is pass-by-reference.