Module: Utopia::Extensions::ArraySplit

Defined in:
lib/utopia/extensions/array_split.rb

Instance Method Summary collapse

Instance Method Details

#split_at(*args, &block) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/utopia/extensions/array_split.rb', line 24

def split_at(*args, &block)
	if middle = index(*args, &block)
		[self[0...middle], self[middle], self[middle+1..-1]]
	else
		[[], nil, []]
	end
end