On 2/20/06, George Ogata <g_ogata / optushome.com.au> wrote:
> ... is a better solution.  So is using `defined?'
> instead of `instance_variables.include?'.

The problem with defined? is that it will only work in an eval
context, that is if you use a block with define_method (which I
personally prefer), then defined?(str_rep_of_var) is always an
expression, so you need to use the instance_variables.include?

Of course if someone has a trick (beyond eval("defined? #{ivar}") I am
interested.