org.jruby
Class RubyMethod

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

public class RubyMethod
extends RubyObject

The RubyMethod class represents a RubyMethod object. You can get such a method by calling the "method" method of an object. Note: This was renamed from Method.java

Since:
0.2.3
Author:
jpetersen

Nested Class Summary
 
Nested classes inherited from class org.jruby.RubyObject
RubyObject.Finalizer
 
Field Summary
protected  RubyModule implementationModule
           
protected  DynamicMethod method
           
protected  java.lang.String methodName
           
protected  RubyModule originModule
           
protected  java.lang.String originName
           
protected  IRubyObject receiver
           
 
Fields inherited from class org.jruby.RubyObject
instanceVariables, isTrue, metaClass, NEVER, OBJECT_ALLOCATOR
 
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
 
Constructor Summary
protected RubyMethod(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, Block unusedBlock)
          Delegate a block call to a bound method call.
 IRubyObject call(IRubyObject[] args, Block block)
          Call the method.
static RubyClass createMethodClass(Ruby runtime)
          Create the RubyMethod class and add it to the Ruby runtime.
 IRubyObject inspect()
          rb_obj_inspect
static IRubyObject mproc(IRubyObject recv, Block block)
          Create a Proc object which is called like a ruby method.
static RubyMethod newMethod(RubyModule implementationModule, java.lang.String methodName, RubyModule originModule, java.lang.String originName, DynamicMethod method, IRubyObject receiver)
           
 IRubyObject to_proc(Block unusedBlock)
          Create a Proc object.
 RubyUnboundMethod unbind(Block unusedBlock)
           
 
Methods inherited from class org.jruby.RubyObject
addFinalizer, anyToString, asString, asSymbol, attachToObjectSpace, callInit, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethodMissingIfNecessary, callSuper, checkArrayType, checkFrozen, checkStringType, compilerCallMethod, compilerCallMethodWithIndex, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToString, convertToType, convertToType, convertToType, convertToTypeWithCheck, createObjectClass, dataGetStruct, dataWrapStruct, display, doClone, dup, eql, eqlInternal, equal, equalInternal, equals, evalSimple, evalUnder, evalWithBinding, extend, freeze, frozen, getInstanceVariable, getInstanceVariables, getInstanceVariablesSnapshot, getJavaClass, getMetaClass, getNativeTypeIndex, getRuntime, getSingletonClass, getSingletonClassClone, getType, hash, hashCode, id_deprecated, id, infectBy, inherited, initCopy, initialize_copy, initialize, instance_eval, instance_exec, instance_of, instance_variable_get, instance_variable_set, instance_variables, instanceVariableNames, isFalse, isFrozen, isImmediate, isKindOf, isNil, isSingleton, isTaint, isTrue, kind_of, makeMetaClass, match, method, methods, nil_p, obj_equal, private_methods, protected_methods, public_methods, puts, rbClone, remove_instance_variable, removeFinalizers, removeInstanceVariable, respond_to, respondsTo, safeGetInstanceVariables, safeHasInstanceVariables, send, setFrozen, setInstanceVariable, setInstanceVariable, setInstanceVariables, setMetaClass, setTaint, singleton_methods, specificEval, taint, tainted, testFrozen, to_s, toString, trueFalseNil, trueFalseNil, type_deprecated, 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 DynamicMethod method

receiver

protected IRubyObject receiver
Constructor Detail

RubyMethod

protected RubyMethod(Ruby runtime,
                     RubyClass rubyClass)
Method Detail

createMethodClass

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


newMethod

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

call

public IRubyObject call(IRubyObject[] args,
                        Block block)
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(Block unusedBlock)
Create a Proc object.


mproc

public static IRubyObject mproc(IRubyObject recv,
                                Block block)
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,
                                 Block unusedBlock)
Delegate a block call to a bound method call. Used by the RubyMethod#to_proc method.


unbind

public RubyUnboundMethod unbind(Block unusedBlock)

inspect

public IRubyObject inspect()
Description copied from class: RubyObject
rb_obj_inspect

Specified by:
inspect in interface IRubyObject
Overrides:
inspect in class RubyObject


Copyright © 2002-2007 JRuby Team. All Rights Reserved.