Hi,

At Sun, 4 Feb 2007 09:32:54 +0900,
Nobuyoshi Nakada wrote in [ruby-core:10187]:
> > Now, I don't *really* need this particular test except to dramatically
> > reduce the number of warnings generated by Transaction::Simple; what
> > I'm curious about is why the change was made. Alternatively, without
> > doing a check on RUBY_VERSION, how can I have one test that works in
> > both Ruby 1.8 and Ruby 1.9?
> 
> 1.9 has and 1.8.6 will have #instance_variable_defined? method.

You can use this code for previous versions.

  unless defined?(instance_variable_defined?)
    module Kernel
      (t = Object.new).instance_eval {@instance_variable = 1}
      case t.instance_variables[0]
      when Symbol
        def instance_variable_defined?(var)
  	instance_variables.include?(var.to_sym)
        end
      when String
        def instance_variable_defined?(var)
  	instance_variables.include?(var.to_s)
        end
      end
    end
  end

-- 
Nobu Nakada