Skip to content

Instantly share code, notes, and snippets.

View invisiwill's full-sized avatar

Will Bridges invisiwill

View GitHub Profile
@invisiwill
invisiwill / flatten_me_code_example.rb
Created February 16, 2017 19:00
Flatten Array Without Flatten
class Array
def flatten_nested_numeric_array
self.inject([]) do |new_array, element|
new_element = element.class == Array ? element.flatten_nested_numeric_array : element
new_array += new_element if new_element.class == Array
new_array << new_element if new_element.class == Fixnum
new_array
end
end