goto_string 0.1.1 → 0.1.2

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