public static IRubyObject def(ThreadContext context, IRubyObject self, Object scriptObject, String rubyName, String javaName, StaticScope scope, int arity, String filename, int line, CallConfiguration callConfig, String parameterDesc) { Class compiledClass = scriptObject.getClass(); Ruby runtime = context.runtime; RubyModule containingClass = context.getRubyClass(); Visibility visibility = context.getCurrentVisibility(); performNormalMethodChecks(containingClass, runtime, rubyName); MethodFactory factory = MethodFactory.createFactory(compiledClass.getClassLoader()); DynamicMethod method = constructNormalMethod( factory, javaName, rubyName, containingClass, new SimpleSourcePosition(filename, line), arity, scope, visibility, scriptObject, callConfig, parameterDesc); addInstanceMethod(containingClass, rubyName, method, visibility,context, runtime); return runtime.getNil(); }
public static IRubyObject def(ThreadContext context, IRubyObject self, Object scriptObject, String rubyName, String javaName, StaticScope scope, int arity, String filename, int line, CallConfiguration callConfig, String parameterDesc) { Class compiledClass = scriptObject.getClass(); Ruby runtime = context.runtime; RubyModule containingClass = context.getRubyClass(); Visibility visibility = context.getCurrentVisibility(); performNormalMethodChecks(containingClass, runtime, rubyName); MethodFactory factory = MethodFactory.createFactory(compiledClass.getClassLoader()); DynamicMethod method = constructNormalMethod( factory, javaName, rubyName, containingClass, new SimpleSourcePosition(filename, line), arity, scope, visibility, scriptObject, callConfig, parameterDesc); addInstanceMethod(containingClass, rubyName, method, visibility,context, runtime); return runtime.getNil(); }