Skip to content

Instantly share code, notes, and snippets.

Ayman Salah moayman

  • Egypt
Block or report user

Report or block moayman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
moayman / flatten_integer_array.rb
Created Oct 22, 2016
Flatten integer array in ruby recursively
View flatten_integer_array.rb
# Extends Array class to include flatten_integer_array
# Method can be used in this manner:
# [1,2,3,4].flatten_integer_array
class Array
def flatten_integer_array output = []
self.each do |a|
if a.is_a? Array
a.flat output
elsif a.is_a? Integer
output << a
You can’t perform that action at this time.