Skip to content

Instantly share code, notes, and snippets.

@headius
Last active January 28, 2026 23:01
Show Gist options
  • Select an option

  • Save headius/d01585d889a1b349db3829cbe414d6d4 to your computer and use it in GitHub Desktop.

Select an option

Save headius/d01585d889a1b349db3829cbe414d6d4 to your computer and use it in GitHub Desktop.
Ruby keyword arguments processing is so simple
return
ruby2_keywords_method ?
calledWithKeywords ?
KwargsAction.DUP_SET_RUBY2_RETURN :
ruby2KeywordHash && splats && empty ?
KwargsAction.NOP :
acceptsKeywords && !empty ?
KwargsAction.DUP_RETURN :
KwargsAction.UNDEFINED :
ruby2KeywordHash ?
acceptsKeywords ?
empty ?
KwargsAction.CLEAR_RUBY2_RETURN :
KwargsAction.DUP_CLEAR_RUBY2_RETURN :
splats ?
empty ?
KwargsAction.NOP :
KwargsAction.DUP_REPLACE_UNDEFINED :
calledWithKeywords ?
empty ?
hasRestArgs ?
KwargsAction.DUP_REPLACE_UNDEFINED :
KwargsAction.UNDEFINED :
KwargsAction.DUP_RETURN :
KwargsAction.UNDEFINED :
!calledWithKeywords ?
KwargsAction.UNDEFINED :
acceptsKeywords && !empty ?
KwargsAction.DUP_RETURN :
KwargsAction.DUP_REPLACE_UNDEFINED;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment