From: Joel VanderWerf Date: 2001-05-20T04:11:22+09:00 Subject: [ruby-talk:15406] Re: how to remove method from singleton class Joel VanderWerf wrote: > > How can I remove a method from a singleton class? > > Is there any way to define a singleton method from a given block without > eval-ing a string? Oh, I need eval because the method name is in a variable: eval <<-END def #{name} # stuff end END What I'd really like is: object.add_instance_method(a_name, a_block) and object.remove_instance_method(a_name) I can make it more efficient by arranging so that I only do the eval once per name, but it's still inelegant... -- Joel VanderWerf California PATH, UC Berkeley mailto:vjoel@path.berkeley.edu Ph. (510) 231-9446 http://www.path.berkeley.edu FAX (510) 231-9512