From: raymond medeiros Date: 2005-09-24T15:22:59+09:00 Subject: OpenClass ------=_Part_843_29935623.1127542973065 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline it seemed like a good idea at the time but honestly, hindsight being 20/20 = i have no idea what i'd do with this: class OpenClass #create the new method def add_member(name, new_proc) self.instance_eval %{ def #{name} #{new_proc} end } end #there are no predefined methods so we'll add them dynamically def method_missing(method, *args) new_proc =3D args[0] mname =3D method.to_s.gsub(/=3D/, "") add_member(mname, new_proc) end end o =3D OpenClass.new o.test_method =3D %{ puts "test_method" } o.test_method irb(main):001:0> o =3D OpenClass.new =3D> # irb(main):002:0> o.test_method =3D %{ puts "test" } =3D> " puts \"test\" " irb(main):003:0> o.test_method test =3D> nil irb(main):004:0> -- 2.times { p true } ------=_Part_843_29935623.1127542973065--