Skip to content

Instantly share code, notes, and snippets.

@kylewelsby
Created June 14, 2013 14:22
Show Gist options
  • Save kylewelsby/5782203 to your computer and use it in GitHub Desktop.
Save kylewelsby/5782203 to your computer and use it in GitHub Desktop.
is there any cleaner way of writing this.
# example 1
array = [1] # input value is a single item in aray
array = array.size == 1 ? array.first : array
# => 1
# example 2
array = [1,2,3] # input value is a collection of items in a array
array = array.size == 1 ? array.first : array
# => [1,2,3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment