RubyGems Navigation menu

goto_string 0.1.4

FEATURES/PROBLEMS: * Partial string matching * The algorithm is not particularly performant == SYNOPSIS: require 'goto_string' s = %w(goto_string is a small library that implements a substring matching and ranking algorithm. The matching and ranking is similar to that found in Quicksilver or TextMate) GotoString::Matcher.match('string', s) #=> [["goto_string", "goto_string", 0.679259259259259, [["string", 5]]], ["substring", "substring", 0.461481481481481, [["s", 0], ["tring", 4]]]] An array is returned which contains one entry for each match. Matches are ordered by rank. Each match is itself an array, containing the following elements: [ "original candidate", "matched string", rank, [["substring_1", offset], ["substring_2", offset], … ] ] You can optionally pass a block to the match method which will get each candidate passed to it. The return value of the block is what will be used for matching. This is so you can pass in arrays of complex objects as candidates: GotoString::Matcher.match( "goto", Project.find(:all) ) do |p| p.name end The resulting matches will contain a reference to the matched string (the project name) as well as the project (the original candidate) == REQUIREMENTS: * None

Versions:

  1. 0.1.4 - August 16, 2007 (6.5 KB)
  2. 0.1.3 - July 19, 2007 (6.5 KB)
  3. 0.1.2 - July 19, 2007 (6.5 KB)
  4. 0.1.1 - July 19, 2007 (5.5 KB)
  5. 0.1.0 - July 19, 2007 (5.5 KB)

Runtime Dependencies:

Authors:

  • Max Muermann

Owners:

42e2ec6a72627f8c15115e279a5f7d8e29f82ebe1801087f04de6aaae92e19ea2caa30c373c7f1d781bcd92647ebf7938b3a5fa50d63275c5c6e304f1a081bfbDca251aafed1b54f223cb0b056c227e48ad0543af286d30d8956588e52974acc4c27a4912d8c64ec6234112924a4ddeeB0a25b4155c21475cdbf6286fc6d15186d76c9adae5a4a262deb9a27075c52fa9f24adfa971912d72f72c1396ef63351

Total downloads 7,942

For this version 1,695

Required Ruby Version: None

Licenses:

N/A

Gemfile:
gem 'goto_string', '~> 0.1.4' = Copy to clipboard Copied!

install:
gem install goto_string = Copy to clipboard Copied!

Links: