Archive for January 2009

Ruby Scoping Bug?

class Foo
def title
“Oh hai.”
end

def buggy
puts title

if false
title = ‘Oh noes!’
end

puts title
end
end

Foo.new.buggy
This code outputs:
Oh hai.
nil
Isn’t it odd that the variable being created [...]