Created
March 24, 2015 23:59
-
-
Save MichaelCPell/031f9e8231b93e64d3c9 to your computer and use it in GitHub Desktop.
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
#sorting | |
def sort_by_length(array) | |
array.sort { |x, y| x.length <=> y.length } | |
end | |
def filter(array) | |
array.select { |v| v > 5 } | |
end | |
#mapping | |
def add_two(array) | |
array.map do |x| | |
"#{x} + 2 = #{x+2}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment