Module: Utopia::Extensions::ArraySplit

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

Instance Method Summary collapse

Instance Method Details

#split_at(*arguments, &block) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/utopia/extensions/array_split.rb', line 9

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