Skip to content

Instantly share code, notes, and snippets.

View carsoncole's full-sized avatar

Carson Cole carsoncole

View GitHub Profile
@carsoncole
carsoncole / array.rb
Last active April 14, 2016 00:59
Ruby method that flattens arbitrary number of nested arrays of integers.
def self.flatten(array)
array.to_s.gsub(/[\[\]]/,'').split(/\s*,\s*/).map { |x| x.to_i }
end