Sha256: 20995825e192901ab112b0e6f7a41136d9582b552149db5dcb9790310bb4747d
Contents?: true
Size: 311 Bytes
Versions: 5
Compression:
Stored size: 311 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 end def normalize(str) str.downcase.gsub(/[^a-z0-9 ]/i, '').strip end end end
Version data entries
5 entries across 5 versions & 1 rubygems