Skip to content

Instantly share code, notes, and snippets.

@thatrubylove
Created February 2, 2015 00:08
Show Gist options
  • Select an option

  • Save thatrubylove/1b5503bcffbfbcd99d14 to your computer and use it in GitHub Desktop.

Select an option

Save thatrubylove/1b5503bcffbfbcd99d14 to your computer and use it in GitHub Desktop.
for emma
h = { a: nil, b: :c, c: nil }
result = h.keys.reduce([]) do |acc, k|
if h[k].nil?
acc << k unless acc.include? k
else
acc << h[k]
acc << k
end
acc
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment