goto_string 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,8 @@
1
- == 0.1.2 / 2007-07-20
1
+ == 0.1.4 / 2007-08-17
2
+
3
+ * fixed fencepost error that allowed unmatched character at the end of a pattern to return a match
4
+
5
+ == 0.1.3 / 2007-07-20
2
6
 
3
7
  * doc patch
4
8
 
data/README.txt CHANGED
@@ -22,11 +22,11 @@ goto_string is a small library that implements a substring matching and ranking
22
22
 
23
23
  Each match is itself an array, containing the following elements:
24
24
 
25
- [ "matched string", "original candidate", rank, [["substring_1", offset], ["substring_2", offset], ... ] ]
25
+ [ "original candidate", "matched string", rank, [["substring_1", offset], ["substring_2", offset], ... ] ]
26
26
 
27
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:
28
28
 
29
- GotoString::Matcher.matching( "goto", Project.find(:all) ) do |p|
29
+ GotoString::Matcher.match( "goto", Project.find(:all) ) do |p|
30
30
  p.name
31
31
  end
32
32
 
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'hoe'
3
3
  require './lib/goto_string.rb'
4
4
 
5
5
  Hoe.new('goto_string', GotoString::VERSION) do |p|
6
- p.rubyforge_name = 'goto_string'
6
+ p.rubyforge_name = 'rails-oceania'
7
7
  p.author = 'Max Muermann'
8
8
  p.email = 'max@muermann.org'
9
9
  p.summary = 'Quicksilver-like partial string matching'
@@ -2,7 +2,7 @@ require 'enumerator'
2
2
  require 'jcode'
3
3
 
4
4
  module GotoString
5
- VERSION = "0.1.3"
5
+ VERSION = "0.1.4"
6
6
 
7
7
  class Matcher
8
8
 
@@ -50,10 +50,11 @@ module GotoString
50
50
  matched_strings.last[0] << s.chr
51
51
  end
52
52
 
53
+ s = nil
53
54
  end
54
55
 
55
- next if !pat.empty?
56
-
56
+ next if !pat.empty? || s
57
+
57
58
  sum_positions = 0
58
59
  consecutive = 0
59
60
 
@@ -79,4 +80,4 @@ module GotoString
79
80
  end
80
81
 
81
82
  end
82
- end
83
+ end
@@ -12,6 +12,14 @@ class TestGotoString < Test::Unit::TestCase
12
12
  assert_equal 'simple', a[2][0]
13
13
  assert_equal 'iamapala', a[3][0]
14
14
  end
15
+
16
+ def test_non_match
17
+ s = %w( iamapala implementation impl simple nomatch )
18
+ a = GotoString::Matcher.match 'implx', s
19
+ assert a
20
+ assert a.empty?
21
+ end
22
+
15
23
 
16
24
  def test_with_block
17
25
  s = %w( iamapala implementation impl simple nomatch )
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.3
7
- date: 2007-07-20 00:00:00 +10:00
6
+ version: 0.1.4
7
+ date: 2007-08-17 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
12
  homepage: " by Max Muermann (max@muermann.org)"
13
- rubyforge_project: goto_string
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"
13
+ rubyforge_project: rails-oceania
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: [ \"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"
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin
@@ -58,5 +58,5 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 1.2.1
61
+ version: 1.2.2
62
62
  version: