Module: Levenshtein::Util

Defined in:
lib/levenshtein.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.pool(*args) ⇒ Object



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/levenshtein.rb', line 122

def self.pool(*args)
  # So we can compare pointers instead of objects (equal?() instead of ==()).

  pool	= {}

  args.collect do |arg|
    a	= []

    arg.each do |o|
      a << pool[o] ||= o
    end

    a
  end
end