class DRb::DRbServer

def check_insecure_method(obj, msg_id)

a NameError is thrown.
SecurityError is thrown. If the method is private or undefined,
If the method is an insecure method (see #insecure_method?) a

method name, as a Symbol.
+obj+ is the object we want to invoke the method on. +msg_id+ is the

Check that a method is callable via dRuby.
def check_insecure_method(obj, msg_id)
  return true if Proc === obj && msg_id == :__drb_yield
  raise(ArgumentError, "#{any_to_s(msg_id)} is not a symbol") unless Symbol == msg_id.class
  raise(SecurityError, "insecure method '#{msg_id}'") if insecure_method?(msg_id)
  case obj
  when Object
    if obj.private_methods.include?(msg_id)
      desc = any_to_s(obj)
      raise NoMethodError, "private method '#{msg_id}' called for #{desc}"
    elsif obj.protected_methods.include?(msg_id)
      desc = any_to_s(obj)
      raise NoMethodError, "protected method '#{msg_id}' called for #{desc}"
    else
      true
    end
  else
    if Kernel.instance_method(:private_methods).bind(obj).call.include?(msg_id)
      desc = any_to_s(obj)
      raise NoMethodError, "private method '#{msg_id}' called for #{desc}"
    elsif Kernel.instance_method(:protected_methods).bind(obj).call.include?(msg_id)
      desc = any_to_s(obj)
      raise NoMethodError, "protected method '#{msg_id}' called for #{desc}"
    else
      true
    end
  end
end