public bool TryGetClrMember(string/*!*/ name, Type asType, out RubyMemberInfo method) {
Debug.Assert(!_isSingletonClass);
// Get the first class in hierarchy that represents CLR type - worse case we end up with Object.
// Ruby classes don't represent a CLR type and hence expose no CLR members.
RubyClass cls = this;
while (cls.TypeTracker == null) {
cls = cls.SuperClass;
}
Type type = cls.TypeTracker.Type;
Debug.Assert(!RubyModule.IsModuleType(type));
// Note: We don't cache results as this API is not used so frequently (e.g. for regular method dispatch).
if (asType != null && !asType.IsAssignableFrom(type)) {
throw RubyExceptions.CreateNameError(String.Format("`{0}' does not inherit from `{1}'", cls.Name, Context.GetTypeName(asType, true)));
}
method = null;
using (Context.ClassHierarchyLocker()) {
return cls.TryGetClrMember(asType ?? type, name, true, true, 0, out method);
}
}