Skip to content

Instantly share code, notes, and snippets.

@rpocklin
Created March 13, 2013 21:35
Show Gist options
  • Save rpocklin/5156541 to your computer and use it in GitHub Desktop.
Save rpocklin/5156541 to your computer and use it in GitHub Desktop.
coerce a single or array parameter into array - keeping args flexible
def some_method(single_or_array)
single_or_array = [*single_or_array]
# do awesome stuff here...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment