Skip to content

Instantly share code, notes, and snippets.

@justinko
Last active May 12, 2017 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinko/bed3e101d3d7d46f318c0df0946397fe to your computer and use it in GitHub Desktop.
Save justinko/bed3e101d3d7d46f318c0df0946397fe to your computer and use it in GitHub Desktop.
def merge_string(a, b)
[a, b].map(&:size).max.times.with_object('') do |(index), output|
[a, b].each {|var| output << (var[index] || '') }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment