Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def flatten values
- result = []
- values.each do |value|
- result.concat(flatten(value)) if value.kind_of?(Array)
- result << value unless value.kind_of?(Array)
- end
- result
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement