class LevenshteinRb::LevenshteinDistance::RecurrenceMatrix

Attributes

store[R]

Public Class Methods

new(m, n) click to toggle source
# File lib/levenshtein_rb/levenshtein_distance.rb, line 16
def initialize(m, n)
  @store = Array.new(m+1) { Array.new(n+1) }

  (0..m).each { |i| store[i][0] = i }
  (0..n).each { |j| store[0][j] = j }
end

Public Instance Methods

[](index) click to toggle source
# File lib/levenshtein_rb/levenshtein_distance.rb, line 8
def [](index)
  store[index]
end
[]=(index, value) click to toggle source
# File lib/levenshtein_rb/levenshtein_distance.rb, line 12
def []=(index, value)
  store[index] = value
end