@Specialization
public RubyArray methods(RubyObject self, boolean includeInherited) {
notDesignedForCompilation();
final RubyArray array = new RubyArray(self.getContext().getCoreLibrary().getArrayClass());
Map<String, RubyMethod> methods;
if (includeInherited) {
methods = ModuleOperations.getAllMethods(self.getMetaClass());
} else {
methods = self.getMetaClass().getMethods();
}
for (RubyMethod method : methods.values()) {
if (method.getVisibility() == Visibility.PUBLIC || method.getVisibility() == Visibility.PROTECTED) {
array.slowPush(self.getContext().newSymbol(method.getName()));
}
}
return array;
}