Sha256: 90780786c7be8dc7ba8101197de642a0ee29edc9ee3bdd2d65d9fb1a85db2065
Contents?: true
Size: 498 Bytes
Versions: 26
Compression:
Stored size: 498 Bytes
Contents
# This file is part of the "Utopia Framework" project, and is licensed under the GNU AGPLv3. # Copyright 2010 Samuel Williams. All rights reserved. # See <utopia.rb> for licensing details. class Array def find_index(&block) each_with_index do |item, index| if yield(item) return index end end return nil end def split_at(&block) index = find_index(&block) if index return [self[0...index], self[index], self[index+1..-1]] end return [[], nil, []] end end
Version data entries
26 entries across 26 versions & 1 rubygems