Top Description Fields Constructors Methods
org.jruby

public Class RubyMethod

extends AbstractRubyMethod
Class Inheritance
Annotations
@JRubyClass
name:Method
Imports
org.jruby.anno.JRubyMethod, .JRubyClass, org.jruby.internal.runtime.methods.AliasMethod, .DynamicMethod, .IRMethodArgs, .PartialDelegatingMethod, .ProcMethod, org.jruby.runtime.ArgumentDescriptor, .Block, .ClassIndex, .Helpers, .JavaSites, .MethodBlockBody, .Signature, .ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.runtime.callsite.CacheEntry

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

Author
jpetersen
Since
0.2.3

Field Summary

Modifier and TypeField and Description
protected IRubyObject
Inherited from org.jruby.AbstractRubyMethod:
entryimplementationModulemethodmethodNameoriginModuleoriginNamesourceModule

Constructor Summary

AccessConstructor and Description
protected
RubyMethod(Ruby runtime, RubyClass rubyClass)

Method Summary

Modifier and TypeMethod and Description
public RubyFixnum

Returns:

the number of arguments of a method.
arity
(ThreadContext context)

Overrides org.jruby.AbstractRubyMethod.arity.

Returns the number of arguments a method accepted.

public IRubyObject
call(ThreadContext context, Block block)

Call the method.

public IRubyObject
call(ThreadContext context, IRubyObject arg, Block block)

public IRubyObject
call(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)

public IRubyObject
call(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)

public IRubyObject
call(ThreadContext context, IRubyObject[] args, Block block)

public static RubyClass
public IRubyObject
public IRubyObject
public IRubyObject
curry(ThreadContext context, IRubyObject[] args)
Deprecated

public RubyMethod
dup(ThreadContext
the thread context
context
)

Overrides default org.jruby.runtime.builtin.IRubyObject.dup.

RubyMethod dup.

public boolean
equals(Object
object to compare
other
)

Overrides org.jruby.AbstractRubyMethod.equals.

This override does not do a "checked" dispatch.

public IRubyObject
public RubyFixnum
hash(ThreadContext
the current thread context
context
)

Overrides org.jruby.RubyBasicObject.hash.

Will return the hash code of this object.

public int
hashCode()

Overrides org.jruby.RubyObject.hashCode.

This override does not do "checked" dispatch since Object usually has #hash defined.

private long
public IRubyObject
inspect(ThreadContext context)

Overrides org.jruby.RubyBasicObject.inspect.

Overrides default org.jruby.runtime.builtin.IRubyObject.inspect.

Returns a string containing a human-readable representation of obj.

private boolean
private boolean
public static RubyMethod
newMethod(RubyModule implementationModule, String methodName, RubyModule originModule, String originName, CacheEntry entry, IRubyObject receiver)

public IRubyObject
public IRubyObject
op_eqq(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyObject.op_eqq.

Implements org.jruby.runtime.builtin.IRubyObject.op_eqq.

rb_equal The Ruby "===" method is used by default in case/when statements.

public RubyBoolean
op_equal(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyBasicObject.op_equal.

Implements org.jruby.runtime.builtin.IRubyObject.op_equal.

rb_obj_equal Will by default use identity equality to compare objects.

public IRubyObject
public IRubyObject
public RubyMethod
public IRubyObject
private static JavaSites.MethodSites
sites(ThreadContext context)

Hides org.jruby.RubyObject.sites.

Retrieve the call sites for this class.

public IRubyObject
public IRubyObject
public IRubyObject
to_proc(ThreadContext context)

Create a Proc object.

public RubyUnboundMethod
Inherited from org.jruby.AbstractRubyMethod:
aritygetFilenamegetLinegetMethodgetMethodNameinspectnameop_eql19ownerprivate_pprotected_ppublic_psuper_method

Field Detail

receiverback to summary
protected IRubyObject receiver

Constructor Detail

RubyMethodback to summary
protected RubyMethod(Ruby runtime, RubyClass rubyClass)

Method Detail

arityback to summary
public RubyFixnum arity(ThreadContext context)

Overrides org.jruby.AbstractRubyMethod.arity.

Returns the number of arguments a method accepted.

Returns:RubyFixnum

the number of arguments of a method.

Annotations
@JRubyMethod
callback to summary
public IRubyObject call(ThreadContext context, Block block)

Call the method.

Annotations
@JRubyMethod
name:call, []
keywords:true
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject arg, Block block)
Annotations
@JRubyMethod
name:call, []
keywords:true
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
Annotations
@JRubyMethod
name:call, []
keywords:true
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
Annotations
@JRubyMethod
name:call, []
keywords:true
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block)
Annotations
@JRubyMethod
name:call, []
rest:true
keywords:true
createMethodClassback to summary
public static RubyClass createMethodClass(ThreadContext context, RubyClass Object)
curryback to summary
public IRubyObject curry(ThreadContext context)
Annotations
@JRubyMethod
curryback to summary
public IRubyObject curry(ThreadContext context, IRubyObject arg0)
Annotations
@JRubyMethod
curryback to summary
public IRubyObject curry(ThreadContext context, IRubyObject[] args)

Deprecated

Annotations
@Deprecated
dupback to summary
public RubyMethod dup(ThreadContext context)

Overrides default org.jruby.runtime.builtin.IRubyObject.dup.

Doc from org.jruby.runtime.builtin.IRubyObject.dup.

RubyMethod dup.

Parameters
context:ThreadContext

the thread context

Returns:RubyMethod

a dup-ed object

Annotations
@JRubyMethod
equalsback to summary
public boolean equals(Object other)

Overrides org.jruby.AbstractRubyMethod.equals.

Doc from org.jruby.RubyObject.equals.

This override does not do a "checked" dispatch.

Parameters
other:Object

Doc from org.jruby.RubyBasicObject.equals.

object to compare

Returns:boolean

Doc from org.jruby.RubyBasicObject.equals.

true if equals

Annotations
@Override
getReceiverback to summary
public IRubyObject getReceiver()
hashback to summary
public RubyFixnum hash(ThreadContext context)

Overrides org.jruby.RubyBasicObject.hash.

Doc from org.jruby.RubyBasicObject.hash.

Will return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.

Parameters
context:ThreadContext

the current thread context

Returns:RubyFixnum

the hash value

Annotations
@JRubyMethod
hashCodeback to summary
public int hashCode()

Overrides org.jruby.RubyObject.hashCode.

Doc from org.jruby.RubyObject.hashCode.

This override does not do "checked" dispatch since Object usually has #hash defined.

Returns:int

the hash code

Annotations
@Override
hashCodeImplback to summary
private long hashCodeImpl()
inspectback to summary
public IRubyObject inspect(ThreadContext context)

Overrides org.jruby.RubyBasicObject.inspect.

Overrides default org.jruby.runtime.builtin.IRubyObject.inspect.

Doc from org.jruby.RubyBasicObject.inspect.

Returns a string containing a human-readable representation of obj. If not overridden, uses the to_s method to generate the string. [ 1, 2, 3..4, 'five' ].inspect #=> "[1, 2, 3..4, \"five\"]" Time.new.inspect #=> "Wed Apr 09 08:54:39 CDT 2003"

Annotations
@JRubyMethod
name:inspect, to_s
isMethodMissingMatchback to summary
private boolean isMethodMissingMatch(DynamicMethod other)
isSerialMatchback to summary
private boolean isSerialMatch(DynamicMethod otherMethod)
newMethodback to summary
public static RubyMethod newMethod(RubyModule implementationModule, String methodName, RubyModule originModule, String originName, CacheEntry entry, IRubyObject receiver)
op_eqlback to summary
public IRubyObject op_eql(ThreadContext context, IRubyObject other)

Overrides org.jruby.AbstractRubyMethod.op_eql.

Annotations
@JRubyMethod
name:eql?
op_eqqback to summary
public IRubyObject op_eqq(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyObject.op_eqq.

Implements org.jruby.runtime.builtin.IRubyObject.op_eqq.

Doc from org.jruby.RubyObject.op_eqq.

rb_equal The Ruby "===" method is used by default in case/when statements. The Object implementation first checks Java identity equality and then calls the "==" method too.

Annotations
@Override
@JRubyMethod
name:===
op_equalback to summary
public RubyBoolean op_equal(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyBasicObject.op_equal.

Implements org.jruby.runtime.builtin.IRubyObject.op_equal.

Doc from org.jruby.RubyBasicObject.op_equal.

rb_obj_equal Will by default use identity equality to compare objects. This follows the Ruby semantics. The name of this method doesn't follow the convention because hierarchy problems

Annotations
@Override
@JRubyMethod
name:==
original_nameback to summary
public IRubyObject original_name(ThreadContext context)

Overrides org.jruby.AbstractRubyMethod.original_name.

Annotations
@JRubyMethod
parametersback to summary
public IRubyObject parameters(ThreadContext context)

Overrides org.jruby.AbstractRubyMethod.parameters.

Annotations
@JRubyMethod
rbCloneback to summary
public RubyMethod rbClone()

Implements abstract org.jruby.AbstractRubyMethod.rbClone.

Implements org.jruby.runtime.builtin.IRubyObject.rbClone.

Doc from org.jruby.runtime.builtin.IRubyObject.rbClone.

RubyMethod clone.

Returns:RubyMethod

a cloned object

Annotations
@JRubyMethod
name:clone
@Override
receiverback to summary
public IRubyObject receiver(ThreadContext context)
Annotations
@JRubyMethod
sitesback to summary
private static JavaSites.MethodSites sites(ThreadContext context)

Hides org.jruby.RubyObject.sites.

Doc from org.jruby.RubyBasicObject.sites.

Retrieve the call sites for this class. It is expected that all Java-based core classes that do call site caching will have a similar method.

source_locationback to summary
public IRubyObject source_location(ThreadContext context)

Overrides org.jruby.AbstractRubyMethod.source_location.

Annotations
@JRubyMethod
super_methodback to summary
public IRubyObject super_method(ThreadContext context)
Annotations
@JRubyMethod
to_procback to summary
public IRubyObject to_proc(ThreadContext context)

Create a Proc object.

Annotations
@JRubyMethod
unbindback to summary
public RubyUnboundMethod unbind()
Annotations
@JRubyMethod