"Gray, Jeff" <jeff.gray / intel.com> wrote in
....
> --
> class Foo
>   def initialize
>     @a = 1
>     @b = 2
>   end
>
>   def inc_iv
>     [:@a, :@b].each { |iv|
>       eval "#{iv} += 1"
>     }
>   end
> end
> --

Hi,

what about?

---
class Foo
     def initialize
         @a = 1
         @b = 2
     end
    def inc_iv
         [@a, @b].collect! { |iv| iv+=1 }
    end
end
---

/Christoph