Type:
Module

Calculates the set of unique abbreviations for a given set of strings.

require 'abbrev'
require 'pp'

pp Abbrev.abbrev(['ruby', 'rules'])

Generates:

{ "rub"   =>  "ruby",
  "ruby"  =>  "ruby",
  "rul"   =>  "rules",
  "rule"  =>  "rules",
  "rules" =>  "rules" }

It also provides an array core extension, Array#abbrev.

pp %w{summer winter}.abbrev
#=> {"summe"=>"summer",
     "summ"=>"summer",
     "sum"=>"summer",
     "su"=>"summer",
     "s"=>"summer",
     "winte"=>"winter",
     "wint"=>"winter",
     "win"=>"winter",
     "wi"=>"winter",
     "w"=>"winter",
     "summer"=>"summer",
     "winter"=>"winter"}
abbrev

abbrev(words, pattern = nil) Class Public methods Given a set of strings, calculate

2015-03-30 01:25:40