guessmethod 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/README.txt +1 -1
- data/Rakefile +1 -1
- data/lib/guessmethod/version.rb +1 -1
- data/spec/guessmethod_spec.rb +44 -5
- data/website/index.html +11 -3
- data/website/index.txt +7 -1
- metadata +11 -2
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -18,7 +18,7 @@ If you accidentally try to access <tt>File::RDWr</tt>, you'll get <tt>File::RDWR
|
|
18
18
|
|
19
19
|
* <code>GuessMethod::Options[:insert_weight]</code>, <code>GuessMethod::Options[:delete_weight]</code>, and <code>GuessMethod::Options[:substitution_weight]</code> change how the levenshtein distance is calculated between method and constant names. The default values are all 1.
|
20
20
|
* <code>GuessMethod::Options[:threshold]</code> determines what levenshtein distance a method or constant must be within to count as a possible match. Values over 2 can give you unpredictable results, especially for short names. The default value is 2.
|
21
|
-
* <code>GuessMethod::Options[:max_inspect_length]</code> is, for now, the longest an object's inspect value can be before it's not displayed in messages, and is replaced with simply the standard #<Object:
|
21
|
+
* <code>GuessMethod::Options[:max_inspect_length]</code> is, for now, the longest an object's inspect value can be before it's not displayed in messages, and is replaced with simply the standard #<Object:0x142100c>. The default value is 25.
|
22
22
|
* <code>GuessMethod::Options[:active]</code> determines whether or not GuessMethod does its thing. If set to false (or nil) it'll step aside. Useful for when it gets in the way of something going off correctly (which happens sometimes).
|
23
23
|
|
24
24
|
= Warning
|
data/Rakefile
CHANGED
@@ -78,7 +78,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
78
78
|
|
79
79
|
# == Optional
|
80
80
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
81
|
-
p.extra_deps = [['highline', '>=1.2.7']] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
81
|
+
p.extra_deps = [['highline', '>=1.2.7'], ['rake', '>=0.7']] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
82
82
|
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
83
83
|
end
|
84
84
|
|
data/lib/guessmethod/version.rb
CHANGED
data/spec/guessmethod_spec.rb
CHANGED
@@ -1,11 +1,50 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
require 'lib/guessmethod.rb'
|
2
3
|
|
3
|
-
|
4
|
-
# http://rspec.rubyforge.org/
|
5
|
-
describe "Place your specs here" do
|
4
|
+
describe "GuessMethod naturally" do
|
6
5
|
|
7
|
-
it "
|
8
|
-
|
6
|
+
it "should define guess_method_missing on Object" do
|
7
|
+
Object.should.respond_to? :guess_method_missing
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should figure out toi means to_i" do
|
11
|
+
'1'.toi.should == 1
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should figure out Float::EPSLON means Float::EPSILON" do
|
15
|
+
Float::EPSLON.should == Float::EPSILON
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should be able to chain replacements" do
|
19
|
+
Cass.nw.clss.should == Clas
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should let an object's NoMethodError through if there's no method in the threshold" do
|
23
|
+
lambda{Class.new.not_a_method}.should raise_error(NoMethodError)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "On a method_missing-defining class, GuessMethod" do
|
29
|
+
before(:all) do
|
30
|
+
class A
|
31
|
+
def method_missing(sym, *args, &block)
|
32
|
+
if sym.to_s == 'foo'
|
33
|
+
'bar'
|
34
|
+
else
|
35
|
+
raise NoMethodError
|
36
|
+
end
|
37
|
+
end
|
38
|
+
include GuessMethod
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should pass on to the class' method_missing past the threshold" do
|
43
|
+
A.new.foo.should == 'bar'
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should let an object's NoMethodError through if there's no method in the threshold" do
|
47
|
+
lambda{A.new.not_a_method}.should raise_error(NoMethodError)
|
9
48
|
end
|
10
49
|
|
11
50
|
end
|
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.6</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ ‘guessmethod’</h1>
|
39
39
|
|
@@ -89,7 +89,7 @@ attention: sending exit instead of eixt to main:Object
|
|
89
89
|
<ul>
|
90
90
|
<li><code>GuessMethod::Options[:insert_weight]</code>, <code>GuessMethod::Options[:delete_weight]</code>, <code>GuessMethod::Options[:substitution_weight]</code> change how the levenshtein distance is calculated between method and constant names. The default values are all 1.</li>
|
91
91
|
<li><code>GuessMethod::Options[:threshold]</code> determines what levenshtein distance a method or constant must be within to count as a possible match. Values over 2 can give you unpredictable results, especially for short names. The default value is 2.</li>
|
92
|
-
<li><code>GuessMethod::Options[:max_inspect_length]</code> is, for now, the longest an object’s inspect value can be before it’s not displayed in messages, and is replaced with simply the standard
|
92
|
+
<li><code>GuessMethod::Options[:max_inspect_length]</code> is, for now, the longest an object’s inspect value can be before it’s not displayed in messages, and is replaced with simply the standard #<Object:0×142100c>. The default value is 25.</li>
|
93
93
|
<li><code>GuessMethod::Options[:active]</code> determines whether or not GuessMethod does its thing. If set to false (or nil) it’ll step aside. Useful for when it gets in the way of something going off correctly (which happens sometimes).</li>
|
94
94
|
</ul>
|
95
95
|
|
@@ -106,6 +106,14 @@ attention: sending exit instead of eixt to main:Object
|
|
106
106
|
<p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a></p>
|
107
107
|
|
108
108
|
|
109
|
+
<h2>GuessMethod and Rails</h2>
|
110
|
+
|
111
|
+
|
112
|
+
<p>If you’re trying to have GuessMethod in your .irbrc (like me), but not have it get in the way of Rails when doing local testing, try this in your .irbrc:</p>
|
113
|
+
|
114
|
+
|
115
|
+
<pre>require 'guessmethod' unless ENV.include?('RAILS_ENV')</pre>
|
116
|
+
|
109
117
|
<h2>License</h2>
|
110
118
|
|
111
119
|
|
@@ -117,7 +125,7 @@ attention: sending exit instead of eixt to main:Object
|
|
117
125
|
|
118
126
|
<p>Comments are welcome. Send an email to chris @@ tie-rack .. org.</p>
|
119
127
|
<p class="coda">
|
120
|
-
website generated via <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>'s <a href="http://newgem.rubyforge.org/">newgem</a>, on
|
128
|
+
website generated via <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>'s <a href="http://newgem.rubyforge.org/">newgem</a>, on 6th August 2007<br>
|
121
129
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
122
130
|
</p>
|
123
131
|
</div>
|
data/website/index.txt
CHANGED
@@ -45,7 +45,7 @@ There are a number of options available which affect how GuessMethod works.
|
|
45
45
|
|
46
46
|
* <code>GuessMethod::Options[:insert_weight]</code>, <code>GuessMethod::Options[:delete_weight]</code>, <code>GuessMethod::Options[:substitution_weight]</code> change how the levenshtein distance is calculated between method and constant names. The default values are all 1.
|
47
47
|
* <code>GuessMethod::Options[:threshold]</code> determines what levenshtein distance a method or constant must be within to count as a possible match. Values over 2 can give you unpredictable results, especially for short names. The default value is 2.
|
48
|
-
* <code>GuessMethod::Options[:max_inspect_length]</code> is, for now, the longest an object's inspect value can be before it's not displayed in messages, and is replaced with simply the standard
|
48
|
+
* <code>GuessMethod::Options[:max_inspect_length]</code> is, for now, the longest an object's inspect value can be before it's not displayed in messages, and is replaced with simply the standard #<Object:0x142100c>. The default value is 25.
|
49
49
|
* <code>GuessMethod::Options[:active]</code> determines whether or not GuessMethod does its thing. If set to false (or nil) it'll step aside. Useful for when it gets in the way of something going off correctly (which happens sometimes).
|
50
50
|
|
51
51
|
h2. How to submit patches
|
@@ -56,6 +56,12 @@ You can check out guessmethod from the svn repository at http://code.tie-rack.or
|
|
56
56
|
|
57
57
|
Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/
|
58
58
|
|
59
|
+
h2. GuessMethod and Rails
|
60
|
+
|
61
|
+
If you're trying to have GuessMethod in your .irbrc (like me), but not have it get in the way of Rails when doing local testing, try this in your .irbrc:
|
62
|
+
|
63
|
+
<pre>require 'guessmethod' unless ENV.include?('RAILS_ENV')</pre>
|
64
|
+
|
59
65
|
h2. License
|
60
66
|
|
61
67
|
This code is free to use under the terms of the MIT license.
|
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.6
|
7
|
+
date: 2007-08-06 00:00:00 -06:00
|
8
8
|
summary: an aggressive spell checker for irb
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -73,3 +73,12 @@ dependencies:
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 1.2.7
|
75
75
|
version:
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: rake
|
78
|
+
version_requirement:
|
79
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: "0.7"
|
84
|
+
version:
|