The easiest way to do this is to have testprivate and override the method sendto specifically block the call test:
class ABC
def test
"test"
end
private :test
def display_test
puts test
end
def send(id)
if id == :test
raise NoMethodError.new("error")
else
super(id)
end
end
alias_method :__send__, :send
end
Note that this override is sendnot correct, because it takes only one parameter.
If you make the right path, it would be possible to do something like this:
ABC.new.send(:send, :test)