Created
February 16, 2019 13:27
-
-
Save aishek/a7e6d79a4f889a288779d46598f3c52a 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
middle = ->(array) { array[array.size / 2] } | |
def plural(string, plural_ending) | |
return string if string.end_with?(plural_ending) | |
"#{string}#{plural_ending}" | |
end | |
files = `ls -a`.split("\n") | |
files | |
.reject { |file| file.start_with?('.') } | |
.sort | |
.yield_self(&middle) | |
.yield_self { |file| plural(file, 's') } | |
.yield_self(&:upcase) | |
.tap { |file| puts file } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment