Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement