guessmethod 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.0.7 2007-08-06
2
+
3
+ * bug fix: GuessMethod::Options[:active] now correctly affects constant guessing
4
+ * little thing
5
+ * added a couple of tests to demonstrate that GuessMethod::Options[:active] does what it should
6
+
1
7
  == 0.0.6 2007-08-06
2
8
 
3
9
  * little things - trying to get guessmethod to pass firebrigade (http://firebrigade.seattlerb.org/gem/show/guessmethod)
data/lib/guessmethod.rb CHANGED
@@ -168,17 +168,21 @@ module GuessConstant
168
168
  end
169
169
 
170
170
  def guess_const_missing(sym)
171
- possible_consts = GuessMethod::Guesser.find_closest(self.constants, sym)
172
- case possible_consts.size
173
- when 1
174
- call_const = possible_consts.first
175
- $stderr.puts GuessMethod::Outputter.replacing_const(sym, call_const, self)
176
- self.const_get(call_const)
177
- when 0
178
- $stderr.puts GuessMethod::Outputter.no_const_in_threshold(sym, self)
179
- old_const_missing(sym)
171
+ if Options[:active]
172
+ possible_consts = GuessMethod::Guesser.find_closest(self.constants, sym)
173
+ case possible_consts.size
174
+ when 1
175
+ call_const = possible_consts.first
176
+ $stderr.puts GuessMethod::Outputter.replacing_const(sym, call_const, self)
177
+ self.const_get(call_const)
178
+ when 0
179
+ $stderr.puts GuessMethod::Outputter.no_const_in_threshold(sym, self)
180
+ old_const_missing(sym)
181
+ else
182
+ $stderr.puts GuessMethod::Outputter.ambigious_const(sym, possible_consts, self)
183
+ old_const_missing(sym)
184
+ end
180
185
  else
181
- $stderr.puts GuessMethod::Outputter.ambigious_const(sym, possible_consts, self)
182
186
  old_const_missing(sym)
183
187
  end
184
188
  end
@@ -2,7 +2,7 @@ module GuessMethod #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 6
5
+ TINY = 7
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -23,6 +23,20 @@ describe "GuessMethod naturally" do
23
23
  lambda{Class.new.not_a_method}.should raise_error(NoMethodError)
24
24
  end
25
25
 
26
+ it "should be off if it gets turned off" do
27
+ GuessMethod::Options[:active] = false
28
+ lambda{Class.nw}.should raise_error(NoMethodError)
29
+ lambda{Cass == Class}.should raise_error(NameError)
30
+ GuessMethod::Options[:active] = true
31
+ end
32
+
33
+ it "should be on if it gets turned on" do
34
+ GuessMethod::Options[:active] = false
35
+ GuessMethod::Options[:active] = true
36
+ lambda{Class.nw}.should_not raise_error
37
+ Cass.should == Class
38
+ end
39
+
26
40
  end
27
41
 
28
42
  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.6</a>
36
+ <a href="http://rubyforge.org/projects/guessmethod" class="numbers">0.0.7</a>
37
37
  </div>
38
38
  <h1>&#x2192; &#8216;guessmethod&#8217;</h1>
39
39
 
metadata CHANGED
@@ -3,7 +3,7 @@ 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.6
6
+ version: 0.0.7
7
7
  date: 2007-08-06 00:00:00 -06:00
8
8
  summary: an aggressive spell checker for irb
9
9
  require_paths: