raymond medeiros <zenlinux / gmail.com> wrote:
> 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 = args[0]
> mname = method.to_s.gsub(/=/, "")
> add_member(mname, new_proc)
> end
> end
> 
> o = OpenClass.new
> o.test_method = %{ puts "test_method" }

I don't see the advantange of this syntax over

def o.test_method() puts "test_method" end

Can you explain?

Kind regards

    robert