I get the following error when running this:

> in `custom_remove_method': undefined local variable or method `symbol' for #<Class:#<String:0x27b7bb0>> (NameError)

Unfortunately, I can't figure out how to get the block to recognize the
symbol variable in the method.
I tried this:

def custom_remove_method(obj, sym)
	obj.instance_variable_set(:@symbol_to_be_removed, obj)
	class << obj
		remove_method(@symbol_to_be_removed)
		remove_instance_variable(:@symbol_to_be_removed)
	end
end

but got this error:
> warning: instance variable @symbol_to_be_removed not initialized
> in `remove_method': nil is not a symbol (TypeError)
at the remove_method(@symbol_to_be_removed) statement.

Even if this hack works, it can possibly cause name clashes at some
level and won't work in a multithreaded environment.

Is there a better approach to getting the class block to recognize the
variable from the outside?