Skip to content

Instantly share code, notes, and snippets.

@karapetyan
Created October 25, 2015 20:17
Show Gist options
  • Save karapetyan/02694e6ed100b6d3625c to your computer and use it in GitHub Desktop.
Save karapetyan/02694e6ed100b6d3625c to your computer and use it in GitHub Desktop.
def weirdcase string
string.split.map { |word| word.each_char.with_index.map { |char, index| index.even? ? char.upcase : char.downcase }.join }.join(" ")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment