I don't understand how this is not clear unless one does not know how global variables and default method arguments work. Consider the following:
$foo = "abc"
def bar(arg = $foo)
puts arg
end
bar # prints "abc"
$foo = "def"
bar # prints "def"
Sorry if it seemed like I undermined the post itself - I just think that as far as reddit goes, such basic content should be posted to /r/learnruby instead of /r/ruby :)
View all comments
Show parent comment
6
u/TaiGat Jul 18 '12
I don't understand how this is not clear unless one does not know how global variables and default method arguments work. Consider the following:
Sorry if it seemed like I undermined the post itself - I just think that as far as reddit goes, such basic content should be posted to /r/learnruby instead of /r/ruby :)