--00504502d319f75192049fc5d029
Content-Type: text/plain; charset=ISO-8859-1
Consider something like this
class Foo
def set_bar(value)
@bar alue
end
def some_method
@bar ? "@bar is not nil or false" : "@bar is not set"
end
end
If ruby raises an error when you call some_method before set_bar, you are
forced to write a initialize method with @bar il in it.
2011/3/31 Josep M. Bach <josep.m.bach / gmail.com>
> Hello,
>
> I think I don't agree/understand how instance variables work in ruby.
>
> For example, when invoking a regular local variable and its name is not
> defined, it raises appropriately a NameError:
>
> >> a
> >>