public final class ArgsUtil
extends java.lang.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 |
extractKeywordArg(ThreadContext context,
RubyHash options,
java.lang.String validKey)
|
static IRubyObject |
extractKeywordArg(ThreadContext context,
java.lang.String keyword,
IRubyObject... args)
Semi-deprecated, kept for compatibility.
|
static IRubyObject |
extractKeywordArg(ThreadContext context,
java.lang.String keyword,
IRubyObject arg)
Semi-deprecated, kept for compatibility.
|
static IRubyObject |
extractKeywordArg(ThreadContext context,
java.lang.String keyword,
RubyHash opts)
Semi-deprecated, kept for compatibility.
|
static IRubyObject[] |
extractKeywordArgs(ThreadContext context,
IRubyObject[] args,
java.lang.String... validKeys) |
static IRubyObject[] |
extractKeywordArgs(ThreadContext context,
RubyHash options,
java.lang.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, java.lang.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, java.lang.String... validKeys)
public static IRubyObject extractKeywordArg(ThreadContext context, RubyHash options, java.lang.String validKey)
context
- options
- validKey
- the keyword to extractoptions[:keyword]
public static IRubyObject extractKeywordArg(ThreadContext context, java.lang.String keyword, RubyHash opts)
extractKeywordArg(ThreadContext, RubyHash, String)
does not validate options!context
- keyword
- opts
- public static IRubyObject extractKeywordArg(ThreadContext context, java.lang.String keyword, IRubyObject arg)
extractKeywordArg(ThreadContext, RubyHash, String)
does not validate options!context
- keyword
- arg
- public static IRubyObject extractKeywordArg(ThreadContext context, java.lang.String keyword, IRubyObject... args)
extractKeywordArg(ThreadContext, RubyHash, String)
does not validate options!context
- keyword
- args
- Copyright © 2001-2020 JRuby. All Rights Reserved.