Sha256: e06bc331bfdfcfb06cde63e51b10bd1dbbff1d53d404d4fac18e3988d49758fd
Contents?: true
Size: 290 Bytes
Versions: 3
Compression:
Stored size: 290 Bytes
Contents
module Glueckskeks class Collapser def self.collapse(str) str.split.map{|s| s.partition(/-|,|\./)}.flatten.delete_if{|n| n == ""}.map do |n| # Keep numbers if /\d\d/ =~ n n[0..1] else n[0] end end.join end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
glueckskeks-0.1.2 | lib/glueckskeks/collapser.rb |
glueckskeks-0.1.1 | lib/glueckskeks/collapser.rb |
glueckskeks-0.1.0 | lib/glueckskeks/collapser.rb |