Created
June 14, 2013 14:22
-
-
Save kylewelsby/5782203 to your computer and use it in GitHub Desktop.
is there any cleaner way of writing this.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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