public final class ArgsUtil extends Object
Constructor and Description |
---|
ArgsUtil() |
Modifier and Type | Method and Description |
---|---|
static int |
arrayLength(IRubyObject node) |
static RubyArray |
convertToRubyArray(Ruby runtime,
IRubyObject value,
boolean coerce)
This name may be a bit misleading, since this also attempts to coerce
array behavior using to_ary.
|
static RubyArray |
convertToRubyArrayWithCoerce(Ruby runtime,
IRubyObject value) |
static IRubyObject |
extractArg(int index,
IRubyObject _default,
IRubyObject... args) |
static IRubyObject |
extractKeywordArg(ThreadContext context,
String keyword,
IRubyObject... args) |
static IRubyObject |
extractKeywordArg(ThreadContext context,
String keyword,
IRubyObject arg) |
static IRubyObject[] |
extractKeywordArgs(ThreadContext context,
IRubyObject[] args,
String[] validKeys) |
static IRubyObject[] |
extractKeywordArgs(ThreadContext context,
RubyHash options,
String[] validKeys)
Check that the given kwargs hash doesn't contain any keys other than those which are given as valid.
|
static IRubyObject |
getOptionsArg(Ruby runtime,
IRubyObject... args) |
static IRubyObject |
getOptionsArg(Ruby runtime,
IRubyObject arg) |
public static RubyArray convertToRubyArray(Ruby runtime, IRubyObject value, boolean coerce)
runtime
- The JRuby runtimevalue
- The value to convertcoerce
- Whether to coerce using to_ary or just wrap with an arraypublic static RubyArray convertToRubyArrayWithCoerce(Ruby runtime, IRubyObject value)
public static int arrayLength(IRubyObject node)
public static IRubyObject getOptionsArg(Ruby runtime, IRubyObject... args)
public static IRubyObject getOptionsArg(Ruby runtime, IRubyObject arg)
public static IRubyObject[] extractKeywordArgs(ThreadContext context, RubyHash options, String[] validKeys)
context
- The context to execute inoptions
- A RubyHash of options to extract kwargs fromvalidKeys
- A list of valid kwargs keys.public static IRubyObject[] extractKeywordArgs(ThreadContext context, IRubyObject[] args, String[] validKeys)
public static IRubyObject extractKeywordArg(ThreadContext context, String keyword, IRubyObject arg)
public static IRubyObject extractKeywordArg(ThreadContext context, String keyword, IRubyObject... args)
public static IRubyObject extractArg(int index, IRubyObject _default, IRubyObject... args)
Copyright © 2001-2016 JRuby. All Rights Reserved.