From: "Shareef J." Date: 2013-02-28T02:36:14+09:00 Subject: Using Object#send to update instance variables Hi there, been trying to figure this out for a while and wanted to check I had the cleanest solution. I have a class with some instance varaibles that I'd like to update by iterating over some matching strings pulled from a config file. The instance variable are either arrays or strings so I want to append to the arrays and overwrite the strings. Is the following best practice? Thanks, Shareef. class Test attr_accessor :string, :array def initialize @string = String.new @array = Array.new end def update(method, arg) if Array === __send__(method) __send__("#{method}") << arg else __send__("#{method}=",arg) end end end -- Posted via http://www.ruby-forum.com/.