org.jruby
Class Method

java.lang.Object
  extended byorg.jruby.RubyObject
      extended byorg.jruby.Method
All Implemented Interfaces:
java.lang.Cloneable, IRubyObject
Direct Known Subclasses:
UnboundMethod

public class Method
extends RubyObject

The RubyMethod class represents a Method object. You can get such a method by calling the "method" method of an object.

Since:
0.2.3
Author:
jpetersen

Field Summary
protected  RubyModule implementationModule
           
protected  ICallable method
           
protected  java.lang.String methodName
           
protected  RubyModule originModule
           
protected  java.lang.String originName
           
protected  IRubyObject receiver
           
 
Fields inherited from class org.jruby.RubyObject
runtime
 
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
 
Constructor Summary
protected Method(Ruby runtime, RubyClass rubyClass)
           
 
Method Summary
 RubyFixnum arity()
          Returns the number of arguments a method accepted.
static IRubyObject bmcall(IRubyObject blockArg, IRubyObject arg1, IRubyObject self)
          Delegate a block call to a bound method call.
 IRubyObject call(IRubyObject[] args)
          Call the method.
static RubyClass createMethodClass(Ruby ruby)
          Create the Method class and add it to the Ruby runtime.
static IRubyObject mproc(IRubyObject recv)
          Create a Proc object which is called like a ruby method.
static Method newMethod(RubyModule implementationModule, java.lang.String methodName, RubyModule originModule, java.lang.String originName, ICallable method, IRubyObject receiver)
           
 IRubyObject to_proc()
          Create a Proc object.
 UnboundMethod unbind()
           
 
Methods inherited from class org.jruby.RubyObject
argCount, asSymbol, callbackFactory, callInit, callMethod, callMethod, callMethod, checkSafeString, convertToString, convertToType, convertType, createObjectClass, defineSingletonMethod, display, dup, equal, equals, eval, eval, evalUnder, extend, extendObject, freeze, frozen, getInstanceVariable, getInstanceVariables, getJavaClass, getMetaClass, getRuntime, getSingletonClass, getType, hash, hashCode, hasInstanceVariable, id, infectBy, inspect, instance_eval, instance_of, instance_variables, instanceVariableNames, isFalse, isFrozen, isKindOf, isNil, isTaint, isTrue, kind_of, makeMetaClass, marshalTo, method_missing, method, methods, nilObject, private_methods, protected_methods, rbClone, removeInstanceVariable, respond_to, respondsTo, send, setFrozen, setInstanceVariable, setInstanceVariable, setInstanceVariables, setMetaClass, setTaint, setupClone, singleton_methods, singletonMethodsAllowed, specificEval, taint, tainted, to_a, to_s, toString, type, untaint
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

implementationModule

protected RubyModule implementationModule

methodName

protected java.lang.String methodName

originModule

protected RubyModule originModule

originName

protected java.lang.String originName

method

protected ICallable method

receiver

protected IRubyObject receiver
Constructor Detail

Method

protected Method(Ruby runtime,
                 RubyClass rubyClass)
Method Detail

createMethodClass

public static RubyClass createMethodClass(Ruby ruby)
Create the Method class and add it to the Ruby runtime.


newMethod

public static Method newMethod(RubyModule implementationModule,
                               java.lang.String methodName,
                               RubyModule originModule,
                               java.lang.String originName,
                               ICallable method,
                               IRubyObject receiver)

call

public IRubyObject call(IRubyObject[] args)
Call the method.


arity

public RubyFixnum arity()
Returns the number of arguments a method accepted.

Returns:
the number of arguments of a method.

to_proc

public IRubyObject to_proc()
Create a Proc object.


mproc

public static IRubyObject mproc(IRubyObject recv)
Create a Proc object which is called like a ruby method. Used by the RubyMethod#to_proc method.


bmcall

public static IRubyObject bmcall(IRubyObject blockArg,
                                 IRubyObject arg1,
                                 IRubyObject self)
Delegate a block call to a bound method call. Used by the RubyMethod#to_proc method.


unbind

public UnboundMethod unbind()


Copyright © 2002 Jan Arne Petersen. All Rights Reserved.