From: Joe Van Dyk Date: 2005-02-04T04:33:09+09:00 Subject: method_missing question Can someone complete the psuedo-code in SomeObject#method_missing for me? Or suggest a better way of doing this? The attributes for SomeObject are, in my application, are generated from a configuration file. Thanks Joe class SomeObject def initialize @attributes = { :x_pos => 20, :y_pos => 30, :z_pos => 40 } end def method_missing(method, *args) # test to see if this is a get or set method if method contains an = set(method minus the equal, args) else get(method) end end def get(attribute) @attributes[attribute] end def set(attribute, value) @attributes[attribute] = value end end my_obj = SomeObject.new my_obj.x_pos = 20 my_obj.z_pos = 40 assert(20, my_obj.x_pos) assert(40, my_obj.z_pos)