2010/8/28 Cameron Vessey <cameron1inm / hotmail.com>:
> Why does this return nil for @city?
Because when you use @city outside a method definition, it is an
instance variable of you *class* Url [1] and not of an instance of you
class.
add
def city
puts @city
end
and call a.city to get what you want.
Cheers,
JJ Fleck
[1] I'm not 100% sure of the naming but what is sure is that the @city
you use is *not* an instance method of your instance a.