public final class ArgsUtil extends Object
Constructor and Description |
---|
ArgsUtil() |
Modifier and Type | Method and Description |
---|---|
static int |
arrayLength(IRubyObject node) |
static IRubyObject[] |
convertToJavaArray(IRubyObject value) |
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 |
convertToRubyArray19(Ruby runtime,
IRubyObject value,
boolean coerce) |
static RubyArray |
convertToRubyArrayWithCoerce(Ruby runtime,
IRubyObject value) |
static RubyArray |
convertToRubyArrayWithCoerce19(Ruby runtime,
IRubyObject value) |
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[] |
popArray(IRubyObject[] array)
Remove first element from array
|
public static IRubyObject[] convertToJavaArray(IRubyObject value)
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 RubyArray convertToRubyArray19(Ruby runtime, IRubyObject value, boolean coerce)
public static RubyArray convertToRubyArrayWithCoerce19(Ruby runtime, IRubyObject value)
public static IRubyObject[] popArray(IRubyObject[] array)
array
- to have first element "popped" offpublic static int arrayLength(IRubyObject node)
public static IRubyObject getOptionsArg(Ruby runtime, IRubyObject... args)
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)
Copyright © 2001-2015 JRuby. All Rights Reserved.