"Dan Doel" <djd15 / po.cwru.edu> schrieb im Newsbeitrag
news:401AE1AC.6090201 / po.cwru.edu...
> You can do it.
>
> [dolio 05:55:13 ~]$ cat prac.rb
> #!/usr/bin/ruby
>
> class Foo
>         attr_reader :bar
> end
>
> obj = Foo.new
>
> obj.instance_eval { @bar = 3 }
>
> p obj.bar
> [dolio 05:55:17 ~]$ ./prac.rb
> 3
> [dolio 05:55:23 ~]$

or:

irb(main):009:0> f=Foo.new
=> #<Foo:0x100dd198>
irb(main):010:0> f.instance_variable_set :@bar, "ha!"
=> "ha!"
irb(main):011:0> f.instance_variable_get :@bar
=> "ha!"
irb(main):012:0>

    robert