Sha256: ff5421838dd761ecf8b196c0c501990c03d8129ee1b7764436f35f12e581bd97
Contents?: true
Size: 316 Bytes
Versions: 2
Compression:
Stored size: 316 Bytes
Contents
module Soulmate module Helpers def prefixes_for_phrase(phrase) words = normalize(phrase).split(' ') words.map do |w| (MIN_COMPLETE-1..(w.length-1)).map{ |l| w[0..l] } end.flatten.uniq end def normalize(str) str.downcase.gsub(/[^a-z0-9 ]/i, '').strip end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
soulmate-0.0.6 | lib/soulmate/helpers.rb |
soulmate-0.0.5 | lib/soulmate/helpers.rb |