guessmethod 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/lib/guessmethod.rb +2 -2
- data/lib/guessmethod/version.rb +1 -1
- data/spec/guessmethod_spec.rb +7 -0
- data/website/index.html +1 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 0.0.8 2007-08-07
|
2
|
+
|
3
|
+
* enhancements
|
4
|
+
* GuessMethod::Guesser ignores case, giving the opportunity to accidentally call to_I and not get a ambiguous method error
|
5
|
+
|
1
6
|
== 0.0.7 2007-08-06
|
2
7
|
|
3
8
|
* bug fix: GuessMethod::Options[:active] now correctly affects constant guessing
|
data/lib/guessmethod.rb
CHANGED
@@ -55,11 +55,11 @@ module GuessMethod
|
|
55
55
|
# match(es) in an array of strings
|
56
56
|
class Guesser
|
57
57
|
def self.find_closest(haystack, needle)
|
58
|
-
closest_distance = haystack.map {|x| x.levenshtein(needle.to_s,
|
58
|
+
closest_distance = haystack.map {|x| x.to_s.downcase.levenshtein(needle.to_s.downcase,
|
59
59
|
Options[:insert_weight], Options[:delete_weight],
|
60
60
|
Options[:substitution_weight])}.min
|
61
61
|
if closest_distance <= Options[:threshold]
|
62
|
-
haystack.find_all {|x| x.levenshtein(needle.to_s,
|
62
|
+
haystack.find_all {|x| x.to_s.downcase.levenshtein(needle.to_s.downcase,
|
63
63
|
Options[:insert_weight], Options[:delete_weight],
|
64
64
|
Options[:substitution_weight]) == closest_distance}
|
65
65
|
else
|
data/lib/guessmethod/version.rb
CHANGED
data/spec/guessmethod_spec.rb
CHANGED
@@ -37,6 +37,13 @@ describe "GuessMethod naturally" do
|
|
37
37
|
Cass.should == Class
|
38
38
|
end
|
39
39
|
|
40
|
+
it "should replace to_I with to_i" do
|
41
|
+
'1'.to_I.should == 1
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should replace RUBY_Version with RUBY_VERSION" do
|
45
|
+
RUBY_Version.should == RUBY_VERSION
|
46
|
+
end
|
40
47
|
end
|
41
48
|
|
42
49
|
describe "On a method_missing-defining class, GuessMethod" do
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>Guess Method</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/guessmethod"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/guessmethod" class="numbers">0.0.
|
36
|
+
<a href="http://rubyforge.org/projects/guessmethod" class="numbers">0.0.8</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ ‘guessmethod’</h1>
|
39
39
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: guessmethod
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.0.8
|
7
|
+
date: 2007-09-22 00:00:00 -06:00
|
8
8
|
summary: an aggressive spell checker for irb
|
9
9
|
require_paths:
|
10
10
|
- lib
|