Sha256: 53544f399adec3de968d076296ae587ef9d697f146385afb02f911c2fdac7f85

Contents?: true

Size: 343 Bytes

Versions: 6

Compression:

Stored size: 343 Bytes

Contents

module Lunar
  # @private A helper for producing all the characters of a word.
  #
  # @example
  #   
  #   expected = %w(a ab abr abra abrah abraha abraham)
  #   FuzzyWord.new("Abraham").partials == expected
  #   # => true
  #
  class FuzzyWord < String
    def partials
      (1..length).map { |i| self[0, i].downcase }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lunar-0.6.0 lib/lunar/fuzzy_word.rb
lunar-0.5.5 lib/lunar/fuzzy_word.rb
lunar-0.5.4 lib/lunar/fuzzy_word.rb
lunar-0.5.3 lib/lunar/fuzzy_word.rb
lunar-0.5.2 lib/lunar/fuzzy_word.rb
lunar-0.5.1 lib/lunar/fuzzy_word.rb