goto_string 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -1
- data/README.txt +10 -8
- data/lib/goto_string.rb +1 -1
- metadata +3 -3
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
goto_string
|
2
|
-
by Max Muermann
|
3
|
-
|
2
|
+
by Max Muermann (max@muermann.org)
|
3
|
+
http://rubyforge.org/projects/rails-oceania/
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
@@ -13,20 +13,22 @@ goto_string is a small library that implements a substring matching and ranking
|
|
13
13
|
|
14
14
|
== SYNOPSIS:
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
require 'goto_string'
|
17
|
+
|
18
|
+
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)
|
19
|
+
GotoString::Matcher.match('string', s) #=> [["goto_string", "goto_string", 0.679259259259259, [["string", 5]]], ["substring", "substring", 0.461481481481481, [["s", 0], ["tring", 4]]]]
|
18
20
|
|
19
21
|
An array is returned which contains one entry for each match. Matches are ordered by rank.
|
20
22
|
|
21
23
|
Each match is itself an array, containing the following elements:
|
22
24
|
|
23
|
-
|
25
|
+
[ "matched string", "original candidate", rank, [["substring_1", offset], ["substring_2", offset], ... ] ]
|
24
26
|
|
25
27
|
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:
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
GotoString::Matcher.matching( "goto", Project.find(:all) ) do |p|
|
30
|
+
p.name
|
31
|
+
end
|
30
32
|
|
31
33
|
The resulting matches will contain a reference to the matched string (the project name) as well as the project (the original candidate)
|
32
34
|
|
data/lib/goto_string.rb
CHANGED
metadata
CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: goto_string
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
6
|
+
version: 0.1.3
|
7
7
|
date: 2007-07-20 00:00:00 +10:00
|
8
8
|
summary: Quicksilver-like partial string matching
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: max@muermann.org
|
12
|
-
homepage: " by Max Muermann"
|
12
|
+
homepage: " by Max Muermann (max@muermann.org)"
|
13
13
|
rubyforge_project: goto_string
|
14
|
-
description: "== FEATURES/PROBLEMS: * Partial string matching * The algorithm is not particularly performant == SYNOPSIS: 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: [ \"matched string\", \"original candidate\", 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.matching( \"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"
|
14
|
+
description: "== 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: [ \"matched string\", \"original candidate\", 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.matching( \"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"
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|