Sha256: 676a7e0f09428987a36dc0c6c7aef6d7411aaf3aaa74e358e280732d8ae05e51
Contents?: true
Size: 373 Bytes
Versions: 7
Compression:
Stored size: 373 Bytes
Contents
class String def naive_split(pattern) string = self.dup found = [] while position = string.index(pattern) found << string.slice!(0, position) string.slice!(0,[pattern.size,1].max) end found << string found end # stub for 1.8 unless method_defined?(:force_encoding) def force_encoding(encoding) self end end end
Version data entries
7 entries across 7 versions & 1 rubygems