Skip to content

Instantly share code, notes, and snippets.

@cheald
Created November 11, 2014 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cheald/eb1868ff80bc5ca7f144 to your computer and use it in GitHub Desktop.
Save cheald/eb1868ff80bc5ca7f144 to your computer and use it in GitHub Desktop.
public static void validateKeywordArgs(ThreadContext context, RubyHash options, IRubyObject[] validKeys) {
RubyArray delta = (RubyArray)options.keys().op_diff(context.runtime.newArray(validKeys));
for (int i = 0; i < delta.length().getIntValue(); i++) {
context.runtime.newArgumentError("unknown keyword: " + delta.at(context.runtime.newFixnum(i)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment