| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
@JRubyMethod allows specifying method signatures, like required, optional, and rest arguments, using normal Java signatures. In most cases, the method binding logic in JRuby will handle all argument counts, arity checking, and argument passing for you. This document describes the allowed combination of signatures.
So a rough specification for the signature would be as follows:
public [static] IRubyObject methodname(
[ThreadContext context, ]
[IRubyObject self, ]
[[IRubyObject arg0 [, ... IRubyObject arg2]] | IRubyObject[] args]
[, Block block]) { @JRubyMethod
public IRubyObject method(IRubyObject arg0) { @JRubyMethod
public static IRubyObject method(ThreadContext context, IRubyObject self, IRubyObject arg0) { // this is called if only no args are passed
@JRubyMethod
public static IRubyObject method() { ... // you should raise error here
// this is called if one arg is passed
@JRubyMethod
public static IRubyObject method(IRubyObject arg0) { ...
// this is called if two or more args are passed
@JRubyMethod
public static IRubyObject method(IRubyObject[] args) { ... // this is called if one argument is passed
@JRubyMethod
public static IRubyObject method(IRubyObject arg0) { ...
// this is called if two arguments are passed
@JRubyMethod
public static IRubyObject method(IRubyObject arg0, IRubyObject arg1) { ...| Back | FazBrowse Home | New Git URL |